|
Posted by purcaholic on 05/21/07 07:51
On 21 Mai, 09:05, shotokan99 <soft_devj...@yahoo.com> wrote:
> hi,
>
> what is wrong with my statement why it is not working:
>
> $sel="select username,password into '$user','$pass'
> from mytable where email = '$p' ";
> mysql_query($sel) or die ('error: cannot perform query');
> echo $user.' '.$pass;
>
> my objective is to assign values to the local variables taking from
> the table. what is the proper way to do it?
Hi shotokan99,
you cant't assign result os an statement to local variables using
something like select ... into ...
You need to pass the result to mysql_fetch_array() or
mysql_fetch_row() to get the result of the executed query. Following
snippd shows the basic usage (without any errorhandling):
[snip]
$sel="select username, password from mytable where email = '$p' ";
$res = mysql_query($sel) or die ('error: cannot perform query');
$row = mysql_fetch_row($res);
echo $row[0].' '.$row[1];
[/snap]
purcaholic
[Back to original message]
|