blufish Posted December 17, 2008 Share Posted December 17, 2008 Here is the code, I does not return anything... <?php if (isset($_POST['where'])) { $_POST['p'] = $_POST['where']; } if (!isset($_POST['p'])) { $_POST['p'] = "home"; } $current_page = $_POST['p']; if ($current_page=="home") { if (!isset($_POST['sort_by')) { $_POST['sort_by'] = "pagetitle"; } if ($_POST['sort_by']=="pagetitle") { $sort_pages_by = "page_title"; } if ($_POST['sort_by']=="pagehits") { $sort_pages_by = "page_hits"; } if ($_POST['sort_by']=="pagevotes") { $sort_pages_by = "vote_good"; } if (!isset($_POST['only_show'])) { $_POST['only_show'] = "all"; } if ($_POST['only_show']=="all") { $page_type = "*"; } if ($_POST['only_show']=="images") { $page_type = "images"; } if ($_POST['only_show']=="text") { $page_type = "text"; } $page_title = "Welcome to Frozenoven!"; $page_contents = "<p>Welcome to Frozenoven, here you can search our content with our database, </p>"; $database_connect = mysql_connect("sql204.byethost7.com","b7_2627673","turds12"); if (!$database_connect) { die('Error Connecting to Database: ' . mysql_error()); } $select_database = mysql_select_db("b7_2627673_pages", $database_connect); if (!select_database) { die ("Error Selecting Database: " . mysql_error()); } $page_contents = $page_contents."<table><tr><th>Page Title</th><th>Thumb Ups!</th><th>Page Hits</th></tr>"; $page_query = mysql_query("SELECT * FROM page_info WHERE page_type=".$page_type." ORDER BY ".$sort_pages_by) or die(mysql_error()); while($page_values = mysql_fetch_array($page_query)) { $page_contents = $page_contents."<tr><td><a href='".$page_values['page_name']."'>".$page_values['page_title'] ."</a></td><td>".$page_values ['vote_good']."</td><td>".$page_values['page_hits']."</td></tr>"; } $page_contents = $page_contents."</table>"; mysql_close($database_connect); } echo page_contents; ?> Quote Link to comment https://forums.phpfreaks.com/topic/137337-having-problems-with-mysql/ Share on other sites More sharing options...
JonnoTheDev Posted December 17, 2008 Share Posted December 17, 2008 Have you tried to print the query to the screen rather than returning results to check if it is valid. Run through mysql to check that results do get returned. Quote Link to comment https://forums.phpfreaks.com/topic/137337-having-problems-with-mysql/#findComment-717609 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.