frizzle wrote:[color=blue]
> I'm not sure if i understood it correctly, but i've solved it like
> this:
>
> $get_admins = mysql_query("SELECT id,username,email,website FROM admin
> ORDER BY id",$db);
> $admins = mysql_fetch_array($get_admins);
>
> do{
>
> if($admins['id']==1)
> {
> $admin1_username= $admins['username'];
> $admin1_email = $admins['email'];
> $admin1_website = $admins['website'];
> }
> else if($admins['id']==2)
> {
> $admin2_username= $admins['username'];
> $admin2_email = $admins['email'];
> $admin2_website = $admins['website'];
> }
> else if($admins['id']==3)
> {
> $admin3_username= $admins['username'];
> $admin3_email = $admins['email'];
> $admin3_website = $admins['website'];
> };
>
> }while($admins = mysql_fetch_array($get_admins));
>
>
> It works, but somehow i feel like i'm missing out something. I wonder
> how i'd do this if i had hundreds of admins: i can't imagine i'd have
> to define the properties for each admin...
>
> Well, anyway it works!
>
> Thanks for that.
>
> I can't figure out my second question though: i only find ways to
> manipulate the output of a query, instead of manipulating the actual
> raw data inside the DB..
>
> Greetings frizzle.
>[/color]
Why not something like (not tested):
$admins = array();
while ($data = mysql_fetch_array($get_admins)) {
$admins[$data['id']] = array('username'=>$data['username'],
'email'=>$data['email'],
'website'->$data['website']);
}
This will place the data in
$admins[1]['username']
$admins[1]['email']
$admins[1]['website']
$admins[2]['username']
etc.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================