Jump to content

[SOLVED] Script will not output anything


Guest bfva

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.