Reply to Re: My_SQL retreival...

Your name:

Reply:


Posted by LaBird on 06/21/05 10:25

Hi,

"Domestos" <never.you@mind.net> wrote in message
news:J4Gte.29644$%21.12323@newsfe2-gui.ntli.net...
> Hi all,
>
> Using PHP to retrieve data out of a PHP table called Users
>
> There are 10 fields in the table, but I just want the first three called
>
> user_name
> user_pass
> user-email
>
> user_name is the primary key...
>
> now - how do i get just these three fields and stick them into php
> variables...
>
> I can connect to the database and everything - I just need the Select
> Statement and the way to get the query result into PHP variables...

How about this:

// $link is the returned resource variable from the DB connection statement
$res = mysql_query("SELECT user_name, user_pass, user-email from Users",
$link);
$i = 0;
// fetch each record into the array $arr one by one
while ($arr = mysql_array_fetch($res, MYSQL_ASSOC)) {
$username[$i] = $arr["user_name"] ;
$userpass[$i] = $arr["user_pass"];
$useremail[$i] = $arr["user-email"];
$i++;
}

Best Regards,
LaBird (Benny).
[email: remove all numerals to get the correct one]

>
> TIA
> Andy Mak
>
>

[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

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