This Post Has Been Viewed 134 Times Since Sat Apr 26, 2008 9:06 pm Posted By Webune with 0 replies
POST# 1330
Posted On: Sat Apr 26, 2008 9:06 pm
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');
}