I'm having a tough time trying to find a solution to this, hopefully someone can shed some light.
I'm trying to grab the earliest and latest date in the database. So this is my code:
This gives me:
Checking the query in MySQL, I get:
Printing the array out in PHP I get (printed before POP and SHIFT):
I don't understand why the SQL works in MySQL but does not return the correct results in PHP. If anyone can find what I'm doing wrong, please let me know.
Thanks for looking.
-T
I'm trying to grab the earliest and latest date in the database. So this is my code:
Code:
$dateresult = mysql_query("SELECT date from tblClass
GROUP BY date");
$datearray = mysql_fetch_array($dateresult);
$e_date = array_shift($datearray);
$l_date = array_pop($datearray);
Code:
$e_date = 1999-11-30
$l_date = 1999-11-30
Code:
+------------+
| date |
+------------+
| 1999-11-30 |
| 2004-02-03 |
| 2005-03-02 |
+------------+
3 rows in set (0.00 sec)
Code:
Array ( [0] => 1999-11-30 [date] => 1999-11-30 )
Thanks for looking.
-T