Re: simple question abt convert to integer
| From: | Bálint Horváth | Date: | Wed, 25 May 2011 04:16:56 +0000 |
| Subject: | Re: simple question abt convert to integer | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-313138@lists.php.net to get a copy of this message | ||
Hi,
I've a simply idea...
If you have integer in your mysql, don't use " at that field in the query....
Try this:
$query="select * from patient where id=".$id."";
There isn't apostrofy in the mysql query...
Bálint Horváth
On 25 May 2011 06:06, "Negin Nickparsa" <nickparsa@gmail.com> wrote:
> 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?