Re: Image Uploading into Database with ID

From: Date: Fri, 13 Jul 2001 05:21:40 +0000
Subject: Re: Image Uploading into Database with ID
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-10370@lists.php.net to get a copy of this message
Hi! so last night I asked is there/how do you do a ocifetchstatement in mysql no one responded...... so this is what I ended up doing..... function new_array($array) { // get the keys $array2 = $array; $keys = array_keys($array2); // now use the keys to get the values for($a=0;$a<count($keys);$a++) { $the_key = $keys[$a]; $value = $array[$the_key]; // we got the value and the key now lets put em where we want em... $new_array = array( "$keys[$a]" => array( "0" => "$value" ) ); $newer_array = array_merge_recursive($newer_array, $new_array); } return($newer_array); } function my_data_array($query,$link) { global $debug; tracker($query); $result = mysql_query($query, $link); while($rows = mysql_fetch_array($result,MYSQL_ASSOC)) { if(!$array) { $array=new_array($rows); } else { $array = array_merge_recursive($array, $rows); } } return($array); } it returns an array that is just like the array returned from ocifetchstatement... so if you are migrating from oracle to mysql and you do not want to rewrite all our scripts... that use ocifetchstatement..... try this on for size :-) hope this helps someone and err saves them some time... if anyone has a better way of doing this please send me the code..... Jimmy Brake

« previous php.db (#10370) next »