Weird Array Issue...

From: Date: Sat, 23 Jan 2010 02:28:48 +0000
Subject: Weird Array Issue...
Groups: php.general 
Request: Send a blank email to php-general+get-301370@lists.php.net to get a copy of this message
Hi, I have defined a stored procedure in my mySQL DB and when I call the procedure in my mySQL browser it returns the CORRECT results: DROP PROCEDURE IF EXISTS Get_OHC_Years; DELIMITER $$ CREATE DEFINER=donw@` PROCEDURE Get_OHC_Years`() BEGIN SELECT (YEAR(ohc_Date)) as ohc_year FROM Office_Hours_Cuttoff GROUP BY YEAR(ohc_Date) ORDER BY YEAR(ohc_Date) ASC; END $$ It returns: -- ohc_year-- 2010 2009 2008 2007 I was assuming this will return an array in my PHP when I call it:
    /**
    *Get All Office Hours Cut-off YEARS
    */
    $db->next_result();
    $years = $db->query("CALL Get_OHC_Years()") or die("Records not found.");
    $yRow = $years->fetch_array();
    echo "<pre>";
print_r($yRow); echo "</pre>"; But the result it returns on my page is: Array ( [0] => 2007 [ohc_year] => 2007 What am I missing? Thanks! Don Wieland D W D a t a C o n c e p t s ~~~~~~~~~~~~~~~~~~~~~~~~~ donw@dwdataconcepts.com Direct Line - (949) 305-2771 Integrated data solutions to fit your business needs. Need assistance in dialing in your FileMaker solution? Check out our Developer Support Plan at: http://www.dwdataconcepts.com/DevSup.html Appointment 1.0v9 - Powerful Appointment Scheduling for FileMaker Pro 9 or higher http://www.appointment10.com For a quick overview - http://www.appointment10.com/Appt10_Promo/Overview.html

« previous php.general (#301370) next »