Guest hauntmisery Posted September 23, 2006 Share Posted September 23, 2006 Hello, I have a bit of a problem here.. im pulling some data form mysql and i need to do a show and hide type thing but i cant seem to find anything that will work cause the data is in a WHILE loop form mysql.. so what do i do now? :o Quote Link to comment https://forums.phpfreaks.com/topic/21760-show-and-hide-using-php/ Share on other sites More sharing options...
Daniel0 Posted September 23, 2006 Share Posted September 23, 2006 What do you mean with "show and hide type thing"? Quote Link to comment https://forums.phpfreaks.com/topic/21760-show-and-hide-using-php/#findComment-97170 Share on other sites More sharing options...
Guest hauntmisery Posted September 23, 2006 Share Posted September 23, 2006 like let me give you a example go here http://www.spookyplanet.com/ and than cick on Animations under the categories youll see the sub list come under Animations Quote Link to comment https://forums.phpfreaks.com/topic/21760-show-and-hide-using-php/#findComment-97172 Share on other sites More sharing options...
Daniel0 Posted September 23, 2006 Share Posted September 23, 2006 That would be a matter of CSS, but I am not sure what you got problems with? Do you create the menu dynamically? Is that the problem? Quote Link to comment https://forums.phpfreaks.com/topic/21760-show-and-hide-using-php/#findComment-97173 Share on other sites More sharing options...
Guest hauntmisery Posted September 23, 2006 Share Posted September 23, 2006 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] Quote Link to comment https://forums.phpfreaks.com/topic/21760-show-and-hide-using-php/#findComment-97174 Share on other sites More sharing options...
Daniel0 Posted September 23, 2006 Share Posted September 23, 2006 What errors do you get using that code? Quote Link to comment https://forums.phpfreaks.com/topic/21760-show-and-hide-using-php/#findComment-97175 Share on other sites More sharing options...
Guest hauntmisery Posted September 23, 2006 Share Posted September 23, 2006 none.. it just shows the sub list in all main catsHome Decor --- Test 1 -------------------------------------------------------------------------------- Illusions --- Test 1 like that.. Quote Link to comment https://forums.phpfreaks.com/topic/21760-show-and-hide-using-php/#findComment-97177 Share on other sites More sharing options...
Daniel0 Posted September 23, 2006 Share Posted September 23, 2006 Can you post a screenshot or give me a link to the site? Quote Link to comment https://forums.phpfreaks.com/topic/21760-show-and-hide-using-php/#findComment-97178 Share on other sites More sharing options...
Guest hauntmisery Posted September 23, 2006 Share Posted September 23, 2006 it dose this..Home Decor --- Test 1 -------------------------------------------------------------------------------- Illusions --- Test 1 Quote Link to comment https://forums.phpfreaks.com/topic/21760-show-and-hide-using-php/#findComment-97181 Share on other sites More sharing options...
Daniel0 Posted September 23, 2006 Share Posted September 23, 2006 You don't like have a screenshot of your output? For what I can tell from what you posted, it looks ok. Quote Link to comment https://forums.phpfreaks.com/topic/21760-show-and-hide-using-php/#findComment-97183 Share on other sites More sharing options...
Guest hauntmisery Posted September 23, 2006 Share Posted September 23, 2006 ill give you a link..http://www.nightmaredesigns.com/previews/monster-tronics/click on home decor and illsusions Quote Link to comment https://forums.phpfreaks.com/topic/21760-show-and-hide-using-php/#findComment-97187 Share on other sites More sharing options...
Daniel0 Posted September 23, 2006 Share Posted September 23, 2006 Try this code: [code]<?phpecho <<<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] Quote Link to comment https://forums.phpfreaks.com/topic/21760-show-and-hide-using-php/#findComment-97189 Share on other sites More sharing options...
Guest hauntmisery Posted September 23, 2006 Share Posted September 23, 2006 Parse error: syntax error, unexpected $end in /home/nightdes/public_html/previews/monster-tronics/index.php on line 279 Quote Link to comment https://forums.phpfreaks.com/topic/21760-show-and-hide-using-php/#findComment-97190 Share on other sites More sharing options...
Daniel0 Posted September 23, 2006 Share Posted September 23, 2006 That must be something you did. My code could in no possible way make that error. Show us the [i]entire[/i] code from index.php and we will show you how to implement the code correctly. Quote Link to comment https://forums.phpfreaks.com/topic/21760-show-and-hide-using-php/#findComment-97191 Share on other sites More sharing options...
Guest hauntmisery Posted September 23, 2006 Share Posted September 23, 2006 still doing the same sub cats in the main cats thang.. Quote Link to comment https://forums.phpfreaks.com/topic/21760-show-and-hide-using-php/#findComment-97193 Share on other sites More sharing options...
wildteen88 Posted September 23, 2006 Share Posted September 23, 2006 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] Quote Link to comment https://forums.phpfreaks.com/topic/21760-show-and-hide-using-php/#findComment-97198 Share on other sites More sharing options...
Guest hauntmisery Posted September 23, 2006 Share Posted September 23, 2006 Parse error: syntax error, unexpected $end in /home/nightdes/public_html/previews/monster-tronics/index.php on line 278EDIT:Parse error: syntax error, unexpected $end in /home/nightdes/public_html/previews/monster-tronics/index.php on line 282 Quote Link to comment https://forums.phpfreaks.com/topic/21760-show-and-hide-using-php/#findComment-97200 Share on other sites More sharing options...
wildteen88 Posted September 23, 2006 Share Posted September 23, 2006 You must of done something to your code, when you copied and pasted the code over, all I did was mofify the if statement. Make sure [b]EOF;[/b] is not indented and is on its own line with no whitespace before or after it. Quote Link to comment https://forums.phpfreaks.com/topic/21760-show-and-hide-using-php/#findComment-97205 Share on other sites More sharing options...
Mutley Posted September 23, 2006 Share Posted September 23, 2006 Those codes are both error free. Post ALL the code to your index.php Your probably missing a closed curley bracket at the end. Quote Link to comment https://forums.phpfreaks.com/topic/21760-show-and-hide-using-php/#findComment-97206 Share on other sites More sharing options...
Guest hauntmisery Posted September 30, 2006 Share Posted September 30, 2006 i could never get this to work... Quote Link to comment https://forums.phpfreaks.com/topic/21760-show-and-hide-using-php/#findComment-101357 Share on other sites More sharing options...
wildteen88 Posted September 30, 2006 Share Posted September 30, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/21760-show-and-hide-using-php/#findComment-101397 Share on other sites More sharing options...
Guest hauntmisery Posted October 1, 2006 Share Posted October 1, 2006 nice nice nice.. it works thanks! Quote Link to comment https://forums.phpfreaks.com/topic/21760-show-and-hide-using-php/#findComment-101720 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.