Jump to content

Show And Hide Using PHP?


Recommended Posts

Guest hauntmisery
yes thats is the problem i have posted my code below

[code]<tr>
                <td><img src="images/cat_left_top.jpg" width="180" height="40"></td>
              </tr>
  <?
  $categories = mysql_query("SELECT * FROM `store_categories` ORDER BY `id`");
              while ($categoriesget = mysql_fetch_array($categories)) {
  ?>
              <tr>
                <td class="cat_text">
                  <a href="?list=<?=$categoriesget[id]?>"><?=$categoriesget[categorie_name];?></a>

<?
if ($_GET['list']) {
$categorie_list = mysql_query("SELECT * FROM `store_categorie_list` WHERE list_categorie_id='$_GET[list]' ORDER BY `id`");
            while ($categorie_list_get = mysql_fetch_array($categorie_list)) {
echo "<br><br>--- $categorie_list_get[list_name]";
}
}
?>

  </td>
              </tr>

              <tr>
                <td height="0"><hr align="center" width="170" size="1" noshade class="cat_bar"></td>
              </tr> <?
  }
  ?>[/code]
Try this code: [code]<?php
echo <<<EOF
<tr>
<td><img src="images/cat_left_top.jpg" width="180" height="40"></td>
</tr>

EOF;
$categories = mysql_query("SELECT * FROM store_categories ORDER BY id");
while($c = mysql_fetch_assoc($categories))
{
echo <<<EOF
<tr>
<td class="cat_text">
<a href="?list={$c['id']}"{$c['categorie_name']}</a>

EOF;
if($_GET['list'])
{
$_GET['list'] = mysql_real_Escape_string($_GET['list']);
$c_list = mysql_query("SELECT * FROM store_categorie_list WHERE list_categorie_id='{$_GET['list']}' ORDER BY id");
while($c_list_item = mysql_fetch_assoc($c_list))
{
echo "\t\t\t<br /><br/>--- {$categorie_list_get['list_name']}\n";
}
}
echo <<<EOF
</td>
</tr>

EOF;
}
echo <<<EOF
<tr>
<td height="0"><hr align="center" width="170" size="1" noshade class="cat_bar"></td>
</tr>

EOF;
?>
[/code]
Try this:
[code]echo <<<EOF
<tr>
<td><img src="images/cat_left_top.jpg" width="180" height="40"></td>
</tr>

EOF;

$categories = mysql_query("SELECT * FROM store_categories ORDER BY id");

while($c = mysql_fetch_assoc($categories))
{
echo <<<EOF
<tr>
<td class="cat_text">
<a href="?list={$c['id']}"{$c['categorie_name']}</a>

EOF;
if(isset($_GET['list']) && is_numeric($_GET['list']) && $_GET['list'] == $c['id'])
{
$_GET['list'] = mysql_real_Escape_string($_GET['list']);
$c_list = mysql_query("SELECT * FROM store_categorie_list WHERE list_categorie_id='{$_GET['list']}' ORDER BY id");

        echo "\t\t\t<p>\n";

        while($c_list_item = mysql_fetch_assoc($c_list))
{
echo "\t\t\t--- {$categorie_list_get['list_name']}<br />\n";
}
}
echo <<<EOF
            </p>
</td>
</tr>

EOF;
}
echo <<<EOF
<tr>
<td height="0"><hr align="center" width="170" size="1" noshade class="cat_bar"></td>
</tr>

EOF;[/code]
Ok. I got rid of all the heredoc statements. Try this:
[code]echo '
    <tr>
        <td><img src="images/cat_left_top.jpg" width="180" height="40"></td>
    </tr>';

$categories = mysql_query("SELECT * FROM store_categories ORDER BY id");

while($c = mysql_fetch_assoc($categories))
{
    echo '
    <tr>
        <td class="cat_text">
            <a href="?list=' . $c['id'] .'">' . $c['categorie_name'] . '</a>';

    if(isset($_GET['list']) && is_numeric($_GET['list']) && $_GET['list'] == $c['id'])
    {
    $_GET['list'] = mysql_real_Escape_string($_GET['list']);

        $sql = "SELECT * FROM store_categorie_list WHERE list_categorie_id='" . $_GET['list'] . "' ORDER BY id";

        $c_list = mysql_query($sql);

        echo "\t\t\t<p>\n";

        while($c_list_item = mysql_fetch_assoc($c_list))
        {
            echo "\t\t\t\t--- {$categorie_list_get['list_name']}<br />\n";
        }
    }

    echo '
            </p>
</td>
    </tr>';
}

echo '
    <tr>
        <td height="0"><hr align="center" width="170" size="1" noshade class="cat_bar"></td>
    </tr>';[/code]
if you cannot get that code to work then there is an error with your code. if you get any error post the full code here.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.