hi. i have tried everything i can come up with, and can not get fix something to "pad" my table with "blank" values.
perhaps it's my approach to the problem. i'm trying to take the return value from my SQL query and enter it into a table.
there's 14 cells, representing 2 weeks.
if i have 14 values, that's fine-- it works perfectly, but i don't. but the array doesn't care about where it needs to "match" rows, so of course when i have "missing days", the array output is no longer matching w/ the "day" column in the "weeks" table.
observe:
Array
(
[1] => Array
(
[dayof] => Feb 26th - Mon
[weekday] => 1
[room] => times_club
[event] => Title Twenty Six
[detail] => Generic Event for a Day 26
)
[2] => Array
(
[dayof] => Feb 27th - Tue
[weekday] => 2
[room] => times_live
[event] => Two Twenty Seven Blue
[detail] => just another event ya
)
[3] => Array
(
[dayof] => Feb 28th - Wed
[weekday] => 3
[room] => times_dancers
[event] => Pretty Girls Dancing
[detail] => The Famous Club Girls perform, debuting the Spring 2007 newcommers!
)
[4] => Array
(
[dayof] => Mar 1st - Thu
[weekday] => 4
[room] => times_club
[event] => March Madness
[detail] => Ring in a new... Month
)
[5] => Array
(
[dayof] => Mar 2nd - Fri
[weekday] => 5
[room] => times_live
[event] => Seconds Of Thrids
[detail] => Celebrate the Second because we need an excuse to get all liquored up
)
[6] => Array
(
[dayof] => Mar 3rd - Sat
[weekday] => 6
[room] => times_dancers
[event] => Generic March event
[detail] => GOod ol March 4th Eve
)
[7] => Array
(
[dayof] => Mar 4th - Sun
[weekday] => 0
[room] => times_club
[event] => The Fourth
[detail] => Generic Event for a Day
)
[8] => Array
(
[dayof] => Mar 6th - Tue
[weekday] => 2
[room] => times_club
[event] => Six Day of Month
[detail] => Beer Flows Like Water
)
[9] => Array
(
[dayof] => Mar 8th - Thu
[weekday] => 4
[room] => times_dancers
[event] => Day Eight
[detail] => No Beer for You
)
[10] => Array
(
[dayof] =>
[weekday] =>
[room] =>
[event] =>
[detail] =>
)
[11] => Array
(
[dayof] =>
[weekday] =>
[room] =>
[event] =>
[detail] =>
)
[12] => Array
(
[dayof] =>
[weekday] =>
[room] =>
[event] =>
[detail] =>
)
[13] => Array
(
[dayof] =>
[weekday] =>
[room] =>
[event] =>
[detail] =>
)
[14] => Array
(
[dayof] =>
[weekday] =>
[room] =>
[event] =>
[detail] =>
)
)
note that the "weekday", which is equivalent to DATE_FORMAT %w of MySQL date output is equal to the array KEy. this is good because it "matches" w/ the HTML columns.
(in abstract thought, not realistically because obviously the HTML columns aren't based on numbers and rows) -- even when it goes back to Zero, i could use a simple formula to subtract 7 from that array Key value to have it match the "%w" value-- but the problem is that the next consecutive value isn't just ((Key-7)+1) , so i'm left with X-amount of places to fill, while the array continues to count out to the total of 14 keys. (sorry-- i know i'm not communicating this very well)
so-- i need an array function to fill those empty spots for me, as i iterate through the DB return... or something. i don't really know how to handle it, obviously.
this is not the straight array output, by the way. it's coming from this code:
for($i=0;$i<=13;$i++) {
$twoWeeks[$i] = $maindata->selectPeriod($table,$field,$startDate,$order,$i);
if ($i>=6){
$keyup = $i+1;
$straightWeeks[$keyup]=$twoWeeks[$i];
} else {
$keyup = $twoWeeks[$i]['weekday'];
$straightWeeks[$keyup]=$twoWeeks[$i];
}
}btw-- don't worry, i know it's inefficient to access the Method (according to VGR's previous rec.). i couldn't get it to work by referencing otherwise. it will require re-engineering more than what you see here i think because i couldn't fix it to passing the right values to the database query "selectPeriod()" as shown in a previous post elsewhere in this forum in the MySQL category...
thanks. sorry if this is ambiguous. i'm just looking for ideas about array functions-- or a completely different approach, if that seems more appropriate?
thanks!!