egturnkey Posted January 16, 2010 Share Posted January 16, 2010 Hello guys , How to recall from database inside array Is that right or wrong ?? require_once("../includes/config.php"); $q1 = "select * from egadmin"; $r1 = mysql_query($q1) or die(mysql_error()); $a1 = mysql_fetch_array($r1); $LOGIN_INFORMATION = array( '$a1[username]' => '$a1[password]' ); Quote Link to comment https://forums.phpfreaks.com/topic/188643-php-in-array/ Share on other sites More sharing options...
Lamez Posted January 16, 2010 Share Posted January 16, 2010 no do it like this <?php $userInfo = array('username' => $a1['username'], 'password' = $a1['password']); echo $userInfo['username']; ?> Quote Link to comment https://forums.phpfreaks.com/topic/188643-php-in-array/#findComment-995907 Share on other sites More sharing options...
x_filed2k Posted January 16, 2010 Share Posted January 16, 2010 It seems that he would like to use the value of field username as an array key and the value is the password.. Try this. require_once("../includes/config.php"); $q1 = "select * from egadmin"; $r1 = mysql_query($q1) or die(mysql_error()); $a1 = mysql_fetch_array($r1); $LOGIN_INFORMATION = array( '$a1['username']' => '$a1['password']' ); Your friend, Alexies Quote Link to comment https://forums.phpfreaks.com/topic/188643-php-in-array/#findComment-995910 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.