I Am Java Posted January 6, 2010 Share Posted January 6, 2010 I can't seem to figure this out, no can a friend of mine. For some reason, it selects the table fine from the database, but it won't show any information from the database: Here is my test page: http://hallowbb.co.cc/pages.ws?page_id=3 <?php include "config.php"; $pageid = $_GET['page_id']; $r=mysql_query("SELECT * FROM `webpages` WHERE `page_id` = '".$pageid."' AND `page_hidden` != '1'") or die(mysql_error()); $pages=mysql_fetch_assoc($r) or die(mysql_error()); $pages2=mysql_num_rows($r); echo "$head <body> <center> $logo </center> <table width='1000' align='center' cellspacing='0' id='topnav' cellpadding='0'> <tr> <td width='100%'> "; include "includes/_topnav.php"; echo " </td> </tr> </table> "; if($pages2=='0' || $pages2>'1'){ echo " <table width='1000' align='center' cellspacing='0' id='subnav' cellpadding='0'> <tr> <td width='50%'> Navigation: <a href='".$url."home".$ex."'>".$sitename."</a> - <a href='pages".$ex."?page_id=".$_GET['page_id']."'>404 Error</a> </td> <td width='50%' style='text-align:right'> "; require "includes/_login.php"; echo " </td> </tr> </table> <table width='1000' align='center' cellspacing='0'> <tr> "; include "includes/_ads.php"; echo " <td width='800' id='main' valign='top'> "; include "includes/_announce.php"; echo " <div class='title'> 404 Error </div> <div class='contents'> The page you were looking for does not exist. Please <a href='javascript:history.go(-1)'>click here</a> to go back and try again. </div> <div class='details'> Page edit details not available. </div> "; } else { echo " <table width='1000' align='center' cellspacing='0' id='subnav' cellpadding='0'> <tr> <td width='50%'> Navigation: <a href='".$url."home".$ex."'>".$sitename."</a> - <a href='pages".$ex."?page_id=".$pages['page_id']."'>".$pages['page_name']."</a> </td> <td width='50%' style='text-align:right'> "; require "includes/_login.php"; echo " </td> </tr> </table> <table width='1000' align='center' cellspacing='0'> <tr> "; include "includes/_ads.php"; echo " <td width='800' id='main' valign='top'> "; include "includes/_announce.php"; echo " <div class='title'> ".$pages['page_name']." </div> <div class='contents'> "; $string = stripslashes($pages['page_contents']); $string1 = str_replace($bbreplace1,$bbreplacements1,$string); $string2 = preg_replace($bbreplace2, $bbreplacements2, $string1); $string = $string2; echo $string." </div> <div class='details'> "; $r2=mysql_query("SELECT * FROM `members` WHERE `id` = '".$pages['edit_by']."'") or die(mysql_error()); $user=mysql_fetch_array($r2); $r3=mysql_query("SELECT * FROM `groups` WHERE `group_id` = '".$user['userlevel']."'") or die(mysql_error()); $group=mysql_fetch_array($r3); $date=$pages['edit_date']; $t=date("m/d/y H:i:s", $date+(5*3600)); echo " Page last updated on ".$t." by <a href='members".$ex."?user=".$pages['edit_by']."'>".stripslashes($group['group_prefix']).stripslashes($user['username']).stripslashes($group['group_suffix'])."</a> </div> "; } echo " </td> </tr> </table> "; echo "<table width='1000' align='center' cellspacing='0' id='copyright'> <tr> <td width='100%'> "; include "includes/_foot.php"; echo " </td> </tr> </table> </body> </html>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/187341-php-not-getting-arrays/ Share on other sites More sharing options...
michaelk46 Posted January 6, 2010 Share Posted January 6, 2010 Try this... echo the search string from the variable and do the search directly at the command prompt while logged in to the MySQL server. Do you get the information that you expect to get displayed on the screen? That way you know whether it's a PHP issue or a MySQL issue. Quote Link to comment https://forums.phpfreaks.com/topic/187341-php-not-getting-arrays/#findComment-989293 Share on other sites More sharing options...
I Am Java Posted January 6, 2010 Author Share Posted January 6, 2010 Try this... echo the search string from the variable and do the search directly at the command prompt while logged in to the MySQL server. Do you get the information that you expect to get displayed on the screen? That way you know whether it's a PHP issue or a MySQL issue. I have used PHPMyAdmin to prove the SQL string works properly, and it does. I have tried just putting in 3 instead of just getting the variable, it didn't work still. Quote Link to comment https://forums.phpfreaks.com/topic/187341-php-not-getting-arrays/#findComment-989299 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.