i am working on a webboard in Thai for an NGO - it works when testing with PHP Triad, however when I upload it - i get "Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource" for lines 71 and 84.
here is the code: any suggestions please?
mysql_connect($host,$user,$passwd) OR die ('Could not select the database: ' . mysql_error() );
$sql = "select No from webboard_data where Category=$Category";
$result = mysql_db_query($dbname,$sql);
$NRow = mysql_num_rows($result);
$rt = $NRow%$list_page;
if($rt!=0) {
$totalpage = floor($NRow/$list_page)+1;
}
else {
$totalpage = floor($NRow/$list_page);
}
$goto = ($page-1)*$list_page;
// Query Thai
$sql = "select * from webboard_data where Category='$Category' order by No DESC limit $goto,$list_page";
$result = mysql_db_query($dbname,$sql);
$NRow = mysql_num_rows($result);
if($NRow==0) {
echo "<font size=2 face='MS Sans Serif'>?????????????</font><br><br>\n";
[SOLVED] testing works but live does not
Moderator: General Moderators
the reason for the error message is because it's found an error in your queries...
try using the query like this :
try using the query like this :
Code: Select all
<?php
// first query
$sql = "select No from webboard_data where Category='".$Category."'";
//second query
$sql = "select * from webboard_data where Category='".$Category."' order by No DESC limit ".$goto.",".$list_page."";
?>- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
tried your suggestion infolock - same problem with lines 71 and 84. again, the only changes i made in the program from testing and live were to add a username and password to the config file, otherwise the files are the same. it seems like a perfect candidate for the register_globals solution but unfortunately not . . . .
i just figured it out! i am not sure why but when setting a username and password in the control panel for the database, the username and password have to agree with the username and password for the overall site, that is i can not set a username and password just for that database. not sure why that is but, when i changed the username and password, the problem went away.
thanks for your prompt responses!
thanks for your prompt responses!