While data geting from mysql error
am 20.01.2007 07:33:44 von vinci
hi to all,
i have one doubt. my mysql table name student..
Fields name: StudName:nvarchar(20); Password: nvarchar(20);
$sname=$_Post['StudName'];
$pwd=$_Post['Password'];
i try to this query.
mysql query
$result=mysql_query("select * from users where StudName=".$sname. "and
password=".$pwd) or die(mysql_error());
but this line not disply correct answer anybody pls help this.
Regards,
Vincent
Re: While data geting from mysql error
am 20.01.2007 12:23:29 von Norman Peelman
vinci wrote:
> hi to all,
> i have one doubt. my mysql table name student..
> Fields name: StudName:nvarchar(20); Password: nvarchar(20);
> $sname=$_Post['StudName'];
> $pwd=$_Post['Password'];
> i try to this query.
>
> mysql query
>
> $result=mysql_query("select * from users where StudName=".$sname. "and
> password=".$pwd) or die(mysql_error());
>
>
> but this line not disply correct answer anybody pls help this.
>
>
> Regards,
> Vincent
>
$result=mysql_query("select * from users where StudName='$sname' and
password='$pwd'") or die(mysql_error());
Norm
Re: While data geting from mysql error
am 10.05.2007 19:23:35 von tom
"vinci" wrote in message
news:1169274824.032738.34640@v45g2000cwv.googlegroups.com...
> hi to all,
> i have one doubt. my mysql table name student..
> Fields name: StudName:nvarchar(20); Password: nvarchar(20);
> $sname=$_Post['StudName'];
> $pwd=$_Post['Password'];
> i try to this query.
>
> mysql query
>
> $result=mysql_query("select * from users where StudName=".$sname. "and
> password=".$pwd) or die(mysql_error());
>
>
> but this line not disply correct answer anybody pls help this.
>
>
> Regards,
> Vincent
>
Depending on the type of information you are trying to query, you normally
need to put the text string in single quotes, unless its a number. Similar
to...
select * from users where StudName='$sname' and password='$pwd';
Tom
--
Newsguy.com - Express Accounts - 30 GB $9.95 / month