Re: simple question abt convert to integer
| From: | Andre Polykanine | Date: | Wed, 25 May 2011 11:21:36 +0000 |
| Subject: | Re: simple question abt convert to integer | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-313149@lists.php.net to get a copy of this message | ||
Hello Negin,
$query1="select * from patient where id=".$_POST['txt'];
$result1=mysql_query($query1);
$rows=mysql_num_rows($result1);
Note: you *didn't* execute the query by calling mysql_query on it.
--
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion
------------ Original message ------------
From: Negin Nickparsa <nickparsa@gmail.com>
To: php-general@lists.php.net
Date created: , 7:05:18 AM
Subject: [PHP] simple question abt convert to integer
my code is this:
$query1="select * from patient where id=".$_POST['txt'];
it works but
i think because i have error in next line:
*Warning*: mysql_num_rows() expects parameter 1 to be resource, boolean
given
$num2=Mysql_num_rows($result1);
i echoed $ query1 and the result was this=>select * from patient where id=1
maybe it can't convert $_POST['txt'] from String to integer and then it
can't get my $num
it is int in my mysql
how can i correct $query1?