I recently changed servers, and now when I try to access my guestbook, I keep getting this error:
Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /home/mendhak/public_html/guestbook/index.php on line 51
For some reason, mysql_numrows, is not... valid/recognized???
Here's the code:
PHP Code:<?php
global $offset; // the string will be in the URL, say index.php?offset=9
if($offset==0 OR $offset==""){
$offset=0;
}
$dbh=mysql_connect("localhost", "mendhak_hello", "hello") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db("mendhak_thewebsite");
$displayperpage = 5; //set this variable to the number of records you want per page.
$sqloffset=$offset*$displayperpage;
$query="SELECT * FROM guestbook ORDER BY id DESC LIMIT $sqloffset,$displayperpage";
$countquery="SELECT COUNT(*) FROM guestbook";
$result=mysql_query($query);
$pagecount=mysql_query($countquery);
$rowsonthispage=mysql_numrows($result);
//[b][color=black]THIS IS LINE 51[/color][/b]
$tempcount = mysql_fetch_row($pagecount);
$num = $tempcount[0]; //now we have total records




Reply With Quote