Neuigkeiten
  • Die modified eCommerce Shopsoftware ist kostenlos, aber nicht umsonst.
    Spenden
  • Damit wir die modified eCommerce Shopsoftware auch zukünftig kostenlos anbieten können:
    Spenden
  • Thema: db value getting null

    jey

    • Frisch an Board
    • Beiträge: 92
    • Geschlecht:
    db value getting null
    am: 10. Februar 2012, 13:34:24
    we are implemented the custom module of FAQ. but html page is not getting value.

    Please check the code and give the solution for this problem.

    faq.php page

    Code: PHP  [Auswählen]
    <?php


    /* -----------------------------------------------------------------------------------------
       $Id: login.php 1143 2005-08-11 11:58:59Z gwinger $  

       XT-Commerce - community made shopping
       http://www.(( Wir dulden keine kommerziellen Werbelinks - Bitte Forenregeln beachten! ))

       Copyright (c) 2003 XT-Commerce
       -----------------------------------------------------------------------------------------
       based on:
       (c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
       (c) 2002-2003 osCommerce(login.php,v 1.79 2003/05/19); www.oscommerce.com
       (c) 2003      nextcommerce (login.php,v 1.13 2003/08/17); www.nextcommerce.org

       Released under the GNU General Public License
       -----------------------------------------------------------------------------------------
       Third Party contribution:

       guest account idea by Ingo T. <xIngox@web.de>
       ---------------------------------------------------------------------------------------*/


    include ('includes/application_top.php');

    /*if (isset ($_SESSION['customer_id'])) {
            xtc_redirect(xtc_href_link(FILENAME_FAQ, '', 'SSL'));
    }*/

    // create smarty elements
    $smarty = new Smarty;
    // include boxes
    require (DIR_FS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/source/boxes.php');

    // include needed functions

    require_once (DIR_FS_INC.'xtc_array_to_string.inc.php');
    require_once (DIR_FS_INC.'xtc_write_user_info.inc.php');
    // redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled (or the session has not started)
    if ($session_started == false) {
            xtc_redirect(xtc_href_link(FILENAME_COOKIE_USAGE));
    }
    $info_message = false; //DokuMan - 2010-02-28 - set undefined variable


    $breadcrumb->add(NAVBAR_TITLE_LOGIN, xtc_href_link(FILENAME_LOGIN, '', 'SSL'));
    require (DIR_WS_INCLUDES.'header.php');

            $faq_query = xtc_db_query("select faq_id, faq_title, faq_text from ".TABLE_FAQ." WHERE languages_id='".(int) $_SESSION['languages_id']."' order by faq_id desc");
           
            $faq_array = array();
           
           
           
            while ($faq = xtc_db_fetch_array($faq_query)) {
                    if (xtc_not_null($faq['faq_id'])) {
                   
                            $faq_array[] = array ('faq' => $faq['faq_title'].'$$'.$faq['faq_text']);
                    }
            }


    $smarty->assign('language', $_SESSION['language']);
    $smarty->caching = 0;
    $main_content = $smarty->fetch(CURRENT_TEMPLATE.'/module/faq.html');
    $smarty->assign('main_content', $main_content);
    $smarty->assign('module_content', '$faq_array');
     
    $smarty->assign('language', $_SESSION['language']);
    $smarty->caching = 0;
    if (!defined(RM))
            $smarty->load_filter('output', 'note');
    $smarty->display(CURRENT_TEMPLATE.'/index.html');
    include ('includes/application_bottom.php');
    ?>

    faq.html page

    Code: PHP  [Auswählen]
    {config_load file="$language/lang_$language.conf" section="faq"}
    <h1>{#heading_faq#}</h1>
    {if $module_content !=''}
            <div>
            {foreach item=more_content_data from=$module_content}
                    <div>{$more_content_data.faq}</div><br>
            {/foreach}
            </div>
    {/if}


    Linkback: https://www.modified-shop.org/forum/index.php?topic=18136.0
    Modulshop - Eine große Auswahl an neuen und hilfreichen Modulen für die modified eCommerce Shopsoftware

    blue5

    • Neu im Forum
    • Beiträge: 6
    • Geschlecht:
    Re: db value getting null
    Antwort #1 am: 13. Februar 2012, 23:09:53
    Please try this:
    - line 66: remove single quotes from '$faq_array'   >   $faq_array is a variable, not a string

    ...also...
    - insert on line 67 -> faq.php this:
    Code: PHP  [Auswählen]
    echo "<pre>";
    print_r($faq_array);
    echo "</pre>";
     
    What does it print out?
    0 Antworten
    2013 Aufrufe
    21. März 2013, 08:57:35 von bio4tler
    3 Antworten
    2773 Aufrufe
    02. Mai 2009, 04:00:20 von vsell
    9 Antworten
    6257 Aufrufe
    20. Juni 2018, 10:46:00 von mahagma
    4 Antworten
    2327 Aufrufe
    24. August 2016, 11:05:04 von web28