JREAM Posted September 6, 2009 Share Posted September 6, 2009 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 More sharing options...
play_ Posted September 6, 2009 Share Posted September 6, 2009 You are retrieving only 1 row. You dont need that while loop. $admin = mysql_fetch_array($result) Link to comment https://forums.phpfreaks.com/topic/173281-php-array-help-i-have-a-coders-block/#findComment-913428 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.