- Forums
- MYSQL
- Making An Array From A Mysql Query
This Page Contains information about Making An Array From A Mysql Query By Webune in category MYSQL with 1 Replies. [2289], Last Updated: Mon Jun 24, 2024
Webune
Fri Oct 30, 2009
1 Comments
392 Visits
sometimes you have to use some data from a query you made and then you find out that you have to do the exact same query again, well, you dont have to just create an array from your mysql query and you can use it again and again. this way you save cpu power on your website. this is what i use often
$config = array();
$sql = "SELECT config_name, config_desc,config_value FROM ".$db_prefix."config";
$result = mysql_query($sql ,$db);
if ($myrow = mysql_fetch_array($result)) {
do {
$config[$myrow['config_name']] = $myrow['config_value'];
} while ($myrow = mysql_fetch_array($result));
} else {
PageError ('ALERT: 12 There was an error with your request');
}
https://www.webune.com/forums/making-an-array-from-a-mysql-query.html