Forum Moderators: coopster
any ideas
$days = array(
2=>array('/weblog/archive/2004/Jan/02','linked-day'),
3=>array('/weblog/archive/2004/Jan/03','linked-day'),
8=>array('/weblog/archive/2004/Jan/08','linked-day'),
22=>array('/weblog/archive/2004/Jan/22','linked-day'),
);
Can I see the relevant code that constructs this array from the database? What seems to not be working correctly? I notice you have an extra comma in there at the end..
it is not outputting from a db YET.
if I put the following code in the script it will add the enent no problem, but I need to create this array from information from my DB.
$days = array(
2=>array('/weblog/archive/2004/Jan/02','linked-day'),
3=>array('/weblog/archive/2004/Jan/03','linked-day'),
8=>array('/weblog/archive/2004/Jan/08','linked-day'),
22=>array('/weblog/archive/2004/Jan/22','linked-day'),
);
so for example the key "2" is ferring to the day.
any ideas?
Then come up with your best-try solution to your problem so that we have some code to go through and we'll get this working for you. A hint is that the query returns an array for each row in the table; you can take this and append it to another array with the correct index for the day.
do{
$days= array($day["daystart"]=>array('index.php?','linked-day'));
} while ($row_Get_User = mysql_fetch_array($Get_User));
i have tries array_push but doesnt seem to work
$container = array(); #holds everything
$Get_User = mysql_query(......
#
while($row = mysql_fetch_assoc($Get_User))
$container[$row['day']] = array($row['archive'], $row['linked_day']);
Try something like this, replacing the query and the specific names of the columns (day, archive, and linked_day).
mysql_select_db($database, $Backoffice);
$query_Get_User = "SELECT *, from_unixtime(datestart,'%d') as daystart,from_unixtime(datefinish,'%d') as dayfinish,from_unixtime(datefinish,'%n') as monthfinish,from_unixtime(datestart,'%m') as monthstart,from_unixtime(datefinish,'%Y') as yearfinish,from_unixtime(datestart,'%Y') as yearstart from todo where user_id = ".$_SESSION['User_id']." and (from_unixtime(datestart,'%m') =07 or from_unixtime(datefinish,'%m') = 07)";
$Get_User = mysql_query($query_Get_User, $Backoffice) or die(mysql_error());
$day = mysql_fetch_array($Get_User);
$totalRows_Get_User = mysql_num_rows($Get_User);
do{
$days= array($day["daystart"]=>array('index.php?','linked-day'));
} while ($row_Get_User = mysql_fetch_array($Get_User));