Reply to Re: select into statement not working..help pls

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация