s4salman Posted June 2, 2018 Share Posted June 2, 2018 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>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/307338-php-query-string-help/ Share on other sites More sharing options...
requinix Posted June 2, 2018 Share Posted June 2, 2018 Look at your server or PHP error log to see what the problem is. Then find yourself a good PHP IDE with syntax highlighting and start writing your code in that instead of whatever you're using now. Quote Link to comment https://forums.phpfreaks.com/topic/307338-php-query-string-help/#findComment-1558734 Share on other sites More sharing options...
maxxd Posted June 2, 2018 Share Posted June 2, 2018 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. Quote Link to comment https://forums.phpfreaks.com/topic/307338-php-query-string-help/#findComment-1558736 Share on other sites More sharing options...
cyberRobot Posted June 4, 2018 Share Posted June 4, 2018 Take a closer look at the following line: if ( $i / $cols == echo "<td colspan='3' align=\"left\"> </td></tr><tr>"; Quote Link to comment https://forums.phpfreaks.com/topic/307338-php-query-string-help/#findComment-1558757 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.