William The Dev William The Dev - 1 year ago 83
SQL Question

Extracting values from SELECT WHERE IN query MySQL

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
array since many rows having the same columns will be returned?

Answer Source
$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'];

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download