s4salman Posted October 15, 2012 Share Posted October 15, 2012 Hello i am getting nothing printed on the page using this code, just a blank page is showing. Can any body help me out from this issue : <?php if (!ini_get("register_globals")) { import_request_variables('GPC'); } //E?C?? ??I C?E? CEO E? $phpver = phpversion(); if ($phpver < '4.1.0') { $_GET = $HTTP_GET_VARS; $_POST = $HTTP_POST_VARS; $_SERVER = $HTTP_SERVER_VARS; } $phpver = explode(".", $phpver); $phpver = "$phpver[0]$phpver[1]"; if ($phpver >= 41) { $PHP_SELF = $_SERVER['PHP_SELF']; } 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 = 50; $result = mysql_query("select count(*) from dada where category='Music'"); $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 dada order by id DESC category='Music' limit $offset, $limit"; $result = mysql_query($query); $num=mysql_numrows($result); ?> <?php $i=0; while ($i<$num) { $id=mysql_result($result,$i,"id"); $name=mysql_result($result,$i,"name"); $image=mysql_result($result,$i,"image"); $category=mysql_result($result,$i,"category"); $linkdown=mysql_result($result,$i,"linkdown"); $pubsite=mysql_result($result,$i,"pubsite"); $description=mysql_result($result,$i,"description"); $os=mysql_result($result,$i,"os"); echo "<b><u><font size=\"4\">$name</font></u></b><br><font size=\"3\">$description</font><br><a href=\"$pubsite\" rel=\"nofollow\"><font color=\"#060d45\"><b>Publisher WebSite</b></font></a> <a href=\"$linkdown\" rel=\"nofollow\"><font color=\"#060d45\"><b>Download</b></font></a> <hr>"; $i++ ; } ?> music.php Quote Link to comment Share on other sites More sharing options...
MDCode Posted October 15, 2012 Share Posted October 15, 2012 $num=mysql_numrows($result); needs to be: $num=mysql_num_rows($result); Quote Link to comment Share on other sites More sharing options...
s4salman Posted October 15, 2012 Author Share Posted October 15, 2012 Thanks for the reply, but this is also giving the same result. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted October 15, 2012 Share Posted October 15, 2012 Your second query statement is malformed. You somehow removed the WHERE keyword and the ORDER BY term comes after the WHERE term. SELECT * FROM your_table WHERE your_where_condition ORDER BY your_order_condition LIMIT $offset, $limit Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted October 15, 2012 Share Posted October 15, 2012 (edited) mysql_numrows is a depreciated alias for mysql_num_rows Edited October 15, 2012 by PFMaBiSmAd Quote Link to comment 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.