1

This is a follow up on minimize select queries on the same table Mysql. I did not get a full answer on how to extract the individual array values returned by the following query:

$result = mysqli_query("SELECT * FROM u_settings WHERE setting IN
 ('username', 'password','email','tag','active','version','time','warn','dis')");

How do I extract any value I want from the $result array since many rows having the same columns will be returned?

4

2 に答える 2

1
$result = mysql_query("SELECT * FROM u_settings WHERE setting IN
 ('username', 'password','email','tag','active','version','time','warn','dis')");

while($row = mysql_fetch_assoc($result))
    $settings[$row['setting']] = $row['u_settings'];

print_r($settings);
于 2012-06-03T20:48:31.940 に答える
1

mysql_fetch_assoc()またはを使用mysql_fetch_array()$resultます。

注:現在廃止されているmysql_ *関数ではなく、MySQLiまたはPDOにアップグレードすることをお勧めします。

于 2012-06-03T20:48:51.070 に答える