Re: While loops to build an array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello S.D.Price,

Your syntax is not correct, try this, instead:
if (mysql_num_rows($result3) > 0){
    while ($row = mysql_fetch_array($result3)) {
        $days[date(j,$row3['entry_date'])] = $row3['newsid'];
    };
}
else {
    echo "<p>The array has not been built.</p>";
};



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 directly
SDP> to a news story. However in order to do this I need to create a $days
SDP> array which takes the date value of the story submitted and the id of
SDP> the story and creates a dynamic link.

SDP> Howver I am finding it difficult to generate the array using a while
SDP> 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





-- 
Best regards,
 re_action                            mailto:re_action@xxxxxxxxxx

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux