mysql table:
+-------------------+----------------+
| config_name       |  config_value  |
+-------------------+----------------+
| allow_autologin   |       1        |
| allow_md5         |       0        |
+-------------------+----------------+
current php codes:
$sth = mysql_query("SELECT ...");
$rows = array();
while($r = mysql_fetch_assoc($sth)) {
    $rows[] = $r;
}
print_r($rows);
current result:
Array
(
    [0] => Array
        (
            开发者_JAVA百科[config_name] => allow_autologin
            [config_value] => 1
        )
    [1] => Array
        (
            [config_name] => allow_md5
            [config_value] => 0
        )
)
I want to get the result like that:
Array(allow_autologin => 1, allow_md5 => 0)
just add to your results like so:
$sth = mysql_query("SELECT ...");
$rows = array();
while($r = mysql_fetch_assoc($sth)) {
    $rows[$r['config_name']] = $r['config_value'];
}
print_r($rows);
while($r = mysql_fetch_assoc($sth)) {
    $rows[] = array($r['config_name'] => $r['config_value']);
}
$sth = mysql_query("SELECT ...");
$rows = array();
while($r = mysql_fetch_assoc($sth)) {
    $rows[$r['config_name']] = $r['config_value'];
}
print_r($rows);
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论