View Single Post
Old 01-24-2012, 08:34 AM  
acctman
Confirmed User
 
Join Date: Oct 2003
Location: Atlanta
Posts: 2,840
Quote:
Originally Posted by ewsmedia View Post
Best for rapid development is to use custom query functions like this

Code:
	function fetchAll($query = false, $key = false) {
		$fetch = false;

		if($query) {
			if($result = mQuery($query)) {
	    		while($res = mysql_fetch_assoc($result)) {

	    			if($key && $res[$key]) {
	    				$fetch[$res[$key]] = $res;
	    			} else {
	    				$fetch[] = $res;
	    			}
	    		}
	    	}
	    }

	    return $fetch;
	}
and than you can tune it all, you will not have your code doubled
still running into the problem of not being able to separate the data by the outputting rows. everytime it does a loop it grabs another row or data. but I can't figure out how to designate a specific id or var for each row+field. if I have 5 rows of data I want to be able to say echo row:2 field: m_pos ... show data
acctman is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote