Jump to content

[SOLVED] Loop Question


Zepo.

Recommended Posts

$con=mysql_query("SELECT name,value FROM configuration");
while(list($name,$value)=mysql_fetch_row($con)){
$config[$name]		='$value';
}

 

Well, it's interesting that you would use the list variable to do it (ironically). My way of doing it, since it seems much simpler (and I've honestly never understood list() function itself or its purpose) would be the following:

 

$con=mysql_query("SELECT name,value FROM configuration");
$config = array();
while($row=mysql_fetch_array($con)){
$name = $row['name'];
$value = $row['value'];
$config[$name] = $value;
}

 

That seems to be a little bit better for me to understand, I honestly don't like/understand list();.

Link to comment
https://forums.phpfreaks.com/topic/73228-solved-loop-question/#findComment-369429
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.