0

i cant understand why this error commimng up

<?php

$mysql_host="xxxx.xxxxxx.xxxx";
$mysql_user="anuncios";
$mysql_password="xxxxxxx";
$mysql_db = "suecia"; 

$conn = mysql_connect("$mysql_host","$mysql_user","$mysql_password")
or die("Could not connect : " . mysql_error());

mysql_select_db("$mysql_db",$conn)
 
or die("Select database failed"); 
 
$code = mysql_query("Select * from jos_call  where code = '".@$_REQUEST['nombre']."'",@$conn);

if (mysql_num_rows($conn)==0){                        //error here//

echo @$_REQUEST['nombre'].' - Codigo correcto';

}else{

echo @$_REQUEST['nombre'].' - Codigo falso';

mysql_close($conn);
}

?>
3
Contributors
7
Replies
8
Views
9 Years
Discussion Span
Last Post by sikka_varun
0

What is the warning? Also, using error suppression is usually bad practice unless absolutely necessary. You should create cases if the variables don't exist so you can easily handle it either way.

0

the error is :

Warning: mysql_num_rows(): supplied resource is not a valid MySQL result resource in /xxxx/xxxx/xxxx
comprueba.php on line 20

0

i have add this and the error is the same: $code = mysql_query("Select * from jos_call where code = '".@$_REQUEST['nombre']."'",@$conn) or die (mysql_error());

0

oh, heh, you're giving mysql_num_rows the connection, you should be giving it the result.

mysql_num_rows($code)
0

oh, heh, you're giving mysql_num_rows the connection, you should be giving it the result.

mysql_num_rows($code)

hi

i have tested with your suggestion
but i have received the same error .

Warning: mysql_num_rows(): supplied resource is not a valid MySQL result resource in

0

Hii..

Try this..

if (mysql_num_rows($code)==0)
{

You should put the result set from mysql_query i.e. $code in mysql_num_rows...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.