| Re_action 2004-11-30, 4:00 pm |
| Hello S.D.Price,
Sorry, but i can't clearly understand, what do you mean by this:
SDP> $days = array([date]=>array(id),)
if every $days[date] should contains array of id's you should use
this:
$days[date(j,$row3['entry_date'])][] = $row3['newsid'];
SDP> Hi thanks but this gives:
SDP> $days[date] = id;
SDP> What I need is a multidimensional array in the form
SDP> $days = array([date]=>array(id),)
SDP> Do you know how to do this?
SDP> thanks
SDP> Steve
SDP> -----Original Message-----
SDP> From: re_action [mailto:re_action@fromru.com]
SDP> Sent: 30 November 2004 17:10
SDP> To: php-windows@lists.php.net
SDP> Subject: Re: [PHP-WIN] While loops to build an array
SDP> Hello S.D.Price,
SDP> Your syntax is not correct, try this, instead:
SDP> if (mysql_num_rows($result3) > 0){
SDP> while ($row = mysql_fetch_array($result3)) {
SDP> $days[date(j,$row3['entry_date'])] = $row3['newsid'];
SDP> };
SDP> }
SDP> else {
SDP> echo "<p>The array has not been built.</p>";
SDP> };
SDP>> Hi, I wonder if you could help. I am trying to build a php based
SDP>> calendar for a news blog. The calendar should create hyperlinks
SDP>> directly to a news story. However in order to do this I need to
SDP>> create a $days array which takes the date value of the story
SDP>> submitted and the id of the story and creates a dynamic link.
SDP>> Howver I am finding it difficult to generate the array using a
SDP>> while loop - do you know a better way?.
SDP>> if (mysql_num_rows($result3) > 0) {
SDP>> $days = array(
SDP>> while ($row = mysql_fetch_array($result3)) {
SDP>> date(j,
SDP>> $row3['entry_date'])=>array($row3['newsid']),;
SDP>> }
SDP>> );
SDP>> }
SDP>> else {
SDP>> echo "<p>The array has not been built.</p>";
SDP>> }
SDP>> echo generate_calendar($year, $month, $days);
SDP>> Thanks
SDP>> Steven
SDP> --
SDP> Best regards,
SDP> re_action mailto:re_action@fromru.com
--
Best regards,
re_action mailto:re_action@fromru.com
|