the table i'm querying the data from is the concerts table you can see in the screen-shot there-- stored as MySQL DATE. this particular function is for a
$seldates1 = "SELECT * from concerts where artist_id1 =$_GET[var]";
w/ two more SELECT queries for artist_id2 and artist_id3. the idea here being that i will be able to complile all of a single artist's dates for a sort of comprehensive display on one page
i'm sorry if this is irrelevant, but just to show you how i'm doing it now, green as i am (btw, i'm not sure if i do, or why i need those global declarations-- but it seems to get rid of the Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource. i'd like to research that a bit more as well-- to know better how to handle the issue in the future! 😉
function getdates() {
global $datesres;
global $conn;
$seldates = "SELECT * from concerts where artist_id1 =$_GET[var]";
$datesres = mysql_query($seldates, $conn) or die(mysql_error());
return $datesres;
}
function getdates2() {
global $datesres2;
global $conn;
$seldates2 = "SELECT * from concerts where artist_id2 =$_GET[var]";
$datesres2 = mysql_query($seldates2, $conn) or die(mysql_error());
return $datesres2;
}
function getdates3() {
global $datesres3;
global $conn;
$seldates3 = "SELECT * from concerts where artist_id3 =$_GET[var]";
$datesres3 = mysql_query($seldates3, $conn) or die(mysql_error());
return $datesres3;
}
$datelist1 = getdates();
$datelist2 = getdates2();
$datelist3 = getdates3();
while ($datesArray1 = mysql_fetch_array($datelist1)) {
$datesoutput = "$datesoutput ".$datesArray1['show_date']."<br>";
}
while ($datesArray2 = mysql_fetch_array($datelist2)) {
$datesoutput2 = "$datesoutput2 ".$datesArray2['show_date']."<br>";
}
while ($datesArray3 = mysql_fetch_array($datelist3)) {
$datesoutput3 = "$datesoutput3 ".$datesArray3['show_date']."<br>";
}
echo "$datesoutput<br>";
echo "$datesoutput2<br>";
echo "$datesoutput3<br>";
i'm sure i've wasted some space w/ it, but at least, at this point, it is giving me what i want, albeit, not without a few
Notice: Undefined variable: datesoutput
in there in its current state!
so, my plan is to take those results, and instead of echoing them raw as they are now, to process, for example, the output
2008-12-20
2006-02-20
2001-06-25
1999-12-31
2007-05-15
into a more human-friendly format.
THANK YOU very much for your input here. i haven't had the chance yet to try anything as i've just now got back to the project, but i'll come back and let you know what i came up with. if seeing this more detailed info turns on any light-bulbs on your end, i'd be most grateful if you'd share your wisdom! 😉
EDIT:
i'm trying to get this to work
<?php
$dt="2005-08-23";
echo date("l, F dS, Y",strtotime($dt));
?>
i think it's just what i need!!
🙂 yay!
except i'm having difficulty figuring out how to extract the dates now that i've setup these arrays
EDIT2:
okay, i learned something so far...
i can eliminate the "Notice: undefined variable..." by declaring those variables as globals at the begining of the script-- resulting in NO errors-- except that i still haven't figured out how to get this strtotime() to work w/ my MySQL DATE format-- i keep getting this error:
Windows does not support dates prior to midnight (00:00:00), January 1, 1970
what can i do to tell PHP how to handle the MySQL date so i don't get that error (assuming that's what's going on)?
thanks again!!!