Making An Array From A Mysql Query

RegisterLogin
Making An Array From A Mysql Query
Post Description: Making An Array From A Mysql Query
Tags: Making, An, Array, From, A, Mysql, Query
This Post Was Posted On Oct 30, 2009 By Webune #1500
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');
	}
Leave Your Comments
Related Pages: [Add Your Website]
Post New Topic
sandorsd
#2830 1
can you show me how to save specific data from mysql query loop in slik tar man ut data fra mysql og viser det på din php side
Nov 16, 2009 Reply Report abuse
©2012 Webune Forums - Thu Dec 13, 2012 3:27 am
Powered by: Webune Forums V3