My bad, it should have the query handle as a parameter of course:

$var=107;
$query = mysql_query("SELECT * FROM table WHERE id={$var};") or
die(mysql_error()); // make sure to use double quotes
var_dump(mysql_error(), mysql_num_rows($query));

$var=mysql_real_escape_string("107");
$query = mysql_query("SELECT * FROM table WHERE id={$var};") or
die(mysql_error()); // make sure to use double quotes
var_dump(mysql_error(), mysql_num_rows($query));

$query = mysql_query("SELECT * FROM table WHERE id=107;") or
die(mysql_error()); // make sure to use double quotes
var_dump(mysql_error(), mysql_num_rows($query));

On Wed, Sep 3, 2008 at 12:21 PM, David DURIEUX <[EMAIL PROTECTED]> wrote:
> Bonjour,
>
>
>
> Cordialement,
>
> David DURIEUX
> Tel : 04.74.04.81.34
> Port : 06.34.99.45.18
> Mail : [EMAIL PROTECTED]
> Site Web : http://www.siprossii.com/
>
> SIPROSSII
> 847 route de Frans (Créacité)
> 69400 Villefranche sur Saône
>
> ID is INT. It's ok before.
>
> I have errors :
>
>
> Warning: Wrong parameter count for mysql_num_rows()
> in /usr/home/sites/CL000001/Web_data/hebergement/pages/sousdomaines.php
> on line 7 string(0) "" NULL
>
> Warning: Wrong parameter count for mysql_num_rows()
> in /usr/home/sites/CL000001/Web_data/hebergement/pages/sousdomaines.php
> on line 12 string(0) "" NULL
>
> Warning: Wrong parameter count for mysql_num_rows()
> in /usr/home/sites/CL000001/Web_data/hebergement/pages/sousdomaines.php
> on line 16 string(0) "" NULL
>
>
>
> Le Wed, 3 Sep 2008 12:11:00 +0200
> "Evert Lammerts" <[EMAIL PROTECTED]> a écrit:
>
>>> In fact the first return 0 results
>>
>>So the problem is in your select, and if your select works when you
>>manually insert the value for id (iow, without using $var), the
>>problem has something to do with $var.
>>
>>Is the data type of the ID column INT? Try the following and let us
>>know the output:
>>
>>$var=107;
>>$query = mysql_query("SELECT * FROM table WHERE id={$var};") or
>>die(mysql_error()); // make sure to use double quotes
>>var_dump(mysql_error(), mysql_num_rows());
>>
>>$var=mysql_real_escape_string("107");
>>$query = mysql_query("SELECT * FROM table WHERE id={$var};") or
>>die(mysql_error()); // make sure to use double quotes
>>var_dump(mysql_error(), mysql_num_rows());
>>
>>$query = mysql_query("SELECT * FROM table WHERE id=107;") or
>>die(mysql_error()); // make sure to use double quotes
>>var_dump(mysql_error(), mysql_num_rows());
>>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Reply via email to