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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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