Jump to content

PHP Array Help (I have a coders block)


JREAM

Recommended Posts

I don't know what my problem is today.

I have this working, print_r($admin) works.

 

but I have to do this to retrieve a value:

$admin[0]['title'];

Is there a way I can do this without the digit?

$admin['title'];

since im only getting one result back?

$sql = "SELECT * FROM users WHERE `id` = 0 LIMIT 1";
$result = mysql_query($sql);

$admin = array();
while ($query = mysql_fetch_array($result)) {
$admin[] = $query;
}

if(empty($admin))
{
$admin = NULL;
}

Link to comment
https://forums.phpfreaks.com/topic/173281-php-array-help-i-have-a-coders-block/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.