Guest bfva Posted February 16, 2007 Share Posted February 16, 2007 This script will not output anything from the database. Here is the code: include ('db.php'); if(!isset($_GET['page'])){ $page = 1; } else { $page = $_GET['page']; } $max_results = "10"; $from = (($page * $max_results) - $max_results); $result = mysql_query("SELECT * FROM table ORDER BY id DESC LIMIT $from, $max_results"); while ($row = mysql_fetch_object($result)) $total_table = "10"; for($a = 1; $a <= $total_table; $a++){ if(($a) == 1){ echo"<div id=\"Preview\" style=\"background-image: url('".$row->avatar."')\"></div>"; echo"<div id=\"Description\"><b>".$row->title."</b><br>Catergory: ".$row->catergory."<br>Added by: ".$row->added."<br>Date Added: ".$row->date."<br></div>"; echo"<div id=\"Link\"><a href='".$row->url."'><img src=\"download.png\"></a><a href='".$row->url."'>Download Now</a></div>"; } else { echo"<div id=\"Preview$a\" style=\"background-image: url('".$row->avatar."')\"></div>"; echo"<div id=\"Description$a\"><b>".$row->title."</b><br>Catergory: ".$row->catergory."<br>Added by: ".$row->added."<br>Date Added: ".$row->date."<br></div>"; echo"<div id=\"Link$a\"><a href='".$row->url."'><img src=\"download.png\"></a><a href='".$row->url."'>Download Now</a></div>"; } } echo "Go to page: "; $total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM table"),0); $total_pages = ceil($total_results / $max_results); for($i = 1; $i <= $total_pages; $i++){ if(($page) == $i){ echo "$i "; } else { echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$i\" title=\"Go to page $i\">$i</a> "; } } You can see the script in action by clicking this link Thanks Link to comment https://forums.phpfreaks.com/topic/38775-solved-script-will-not-output-anything/ Share on other sites More sharing options...
Jessica Posted February 16, 2007 Share Posted February 16, 2007 Post your code within code tags. Link to comment https://forums.phpfreaks.com/topic/38775-solved-script-will-not-output-anything/#findComment-186323 Share on other sites More sharing options...
mbtaylor Posted February 16, 2007 Share Posted February 16, 2007 Id say its a blank page because you have turned off display_errors in your php.ini and there is a parse error or something. Turn display_errors on temporarily or look in your apache error_log to see whats wrong. Link to comment https://forums.phpfreaks.com/topic/38775-solved-script-will-not-output-anything/#findComment-186412 Share on other sites More sharing options...
Guest bfva Posted February 16, 2007 Share Posted February 16, 2007 I tried that and it gave me no errors Link to comment https://forums.phpfreaks.com/topic/38775-solved-script-will-not-output-anything/#findComment-186420 Share on other sites More sharing options...
Jessica Posted February 16, 2007 Share Posted February 16, 2007 while ($row = mysql_fetch_object($result)){ you were missing a { Indent your code! Link to comment https://forums.phpfreaks.com/topic/38775-solved-script-will-not-output-anything/#findComment-186423 Share on other sites More sharing options...
Guest bfva Posted February 16, 2007 Share Posted February 16, 2007 Thanks for your help Link to comment https://forums.phpfreaks.com/topic/38775-solved-script-will-not-output-anything/#findComment-186425 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.