Jump to content

Php Query String Help


s4salman

Recommended Posts

I am getting HTTP ERROR 500 . Please help me in this code. Thank You

 

<?php
$id = $_GET['id'];

?>

<?php

$db="s4salman_color";

$conn = mysql_connect("localhost","s4salman_user","salmanreadskalakaka");
@mysql_select_db($db) or die( "Unable to select database, Please contact your administrator");


class Pager 
   { 
       function getPagerData($numHits, $limit, $page) 
       { 
           $numHits  = (int) $numHits; 
           $limit    = max((int) $limit, 1); 
           $page     = (int) $page; 
           $numPages = ceil($numHits / $limit); 

           $page = max($page, 1); 
           $page = min($page, $numPages); 

           $offset = ($page - 1) * $limit; 

           $ret = new stdClass; 

           $ret->offset   = $offset; 
           $ret->limit    = $limit; 
           $ret->numPages = $numPages; 
           $ret->page     = $page; 

           return $ret; 
       } 
   }  

    // get the pager input values 
    $page = $_GET['page']; 
    $limit = 3; 
    $result = mysql_query("SELECT COUNT(*) FROM coloringpages WHERE id='$id'"); 
    $total = mysql_result($result, 0, 0); 

    // work out the pager values 
    $pager  = Pager::getPagerData($total, $limit, $page); 
    $offset = $pager->offset; 
    $limit  = $pager->limit; 
    $page   = $pager->page; 

    // use pager values to fetch data 
    $query = "select * from coloringpages where id='$id' order by id DESC limit $offset, $limit"; 
    $result = mysql_query($query); 

    // use $result here to output page content 


//my addition

//grab all the content

   //Custom Table Stsrt//
        $cols = 4; //number of coloms
        $i =1;
        echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"2\" width=\"100%\" id=\"table1\" bordercolor=\"#FFFFFF\" bgcolor=\"#FFFFFF\">"
             ."<tr>";

while($r=mysql_fetch_array($result))
{	
   //the format is $variable = $r["nameofmysqlcolumn"];
   //modify these to match your mysql table columns
  
   $id=$r["id"];
   $name=$r["name"];
   
   
   $img=$r["img"];
   $cat=$r["cat"];
  
   
   
   //display the row
   
   
   
   $mybox = "
   
   <br>
   <a href='http://salmobile.info/3gp-videos-download.php?id=$id' class=\"classd\"><b><u> $name</u></b></a>
   <BR>
   <span class=\"text\"><img src=\"$img\" width=\"60\" height=\"60\"></span>
   <BR>
   <span class=\"text2\">Download This 3GP Video</span>
   <br>";


                if (is_int($i / $cols)){
                    echo "<td width='336' align='center' style=\"border-style: dotted; border-width: 0\">$mybox</td></tr><tr>";
                }else{
                    echo "<td width='336' align='center' style=\"border-style: dotted; border-width: 0\">$mybox</td>";
                }
             if ( $i / $cols == 3) echo "<td colspan='3' align=\"center\">


</td></tr><tr>";

if ( $i / $cols ==  echo "<td colspan='3' align=\"left\">

</td></tr><tr>";

             $i++;
          //end if
       }//end while
       echo "</tr></table>";
       //Custom Table End//
   


//ends my addition



    // output paging system (could also do it before we output the page content) 
    if ($page == 1) // this is the first page - there is no previous page 
        echo "<font color=\"#FFB300\">Previous</font>"; 
    else            // not the first page, link to the previous page 
        echo "<a href=\"http://salmobile.info/index-" . ($page - 1) . ".html\" id=\"navigationURL\"><font color=\"#FFB300\">Previous</font></a>"; 

    for ($i = 1; $i <= $pager->numPages; $i++) { 
        echo " <font color=\"#FFFFFF\">|</font> "; 
        if ($i == $pager->page) 
            echo "<font color=\"#FFB300\"> $i</font>"; 
        else 
            echo "<a href=\"http://salmobile.info/index-$i.html\" id=\"navigationURL\"> <font color=\"#FFB300\">$i</font></a>"; 
    } 

    if ($page == $pager->numPages) // this is the last page - there is no next page 
        echo "Next"; 
    else            // not the last page, link to the next page 
        echo "   <a href=\"http://salmobile.info/index-" . ($page + 1) . ".html\" id=\"navigationURL\"><font color=\"#FFB300\">Next</font></a>"; 
?>

 

Link to comment
Share on other sites

And stop using mysql_* functions. They've been deprecated long enough that commercial hosts are starting to catch up. I'd bet you've got maybe six months to a year before any work you do to make your code work is rendered useless anyway.

Link to comment
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.