mySql_num_rows() Problem
Posted: Fri Oct 06, 2006 12:29 pm
The page show the results of a search page. I try to use this code:
Really I have two problems:
1- This warning
PHP Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\Inetpub\wwwroot\SML_PHP\total.php on line 74
2- No matter if exist or not records always appear the "No existen Registros"
If I don't use mySql_num_rows() all work fine....
Please what is wrong?
Thanks
Code: Select all
<?php
$vTema=$_POST['txtTema'];
$vRitmo=$_POST['txtRitmo'];
$vAutor=$_POST['txtAutor'];
$vInter=$_POST['txtInter'];
?>
...............more code.............
$sql = 'select id,clase,tema,ritmo,autor,arreglo,fecha,kar,nuevo,archivo from temas where RITMO like \'%'.$vRitmo.'%\' && TEMA like \'%'.$vTema.'%\' && AUTOR like \'%'.$vAutor.'%\' && ARREGLO like \'%'.$vInter.'%\' order by tema';
$result = mysql_query($sql);
$reg = mysql_num_rows($sql); //Line 74
if (!$reg)
echo "<center><b><font color='#FF0000'>No existen Registros</font></b></center><br>";1- This warning
PHP Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\Inetpub\wwwroot\SML_PHP\total.php on line 74
2- No matter if exist or not records always appear the "No existen Registros"
If I don't use mySql_num_rows() all work fine....
Please what is wrong?
Thanks