pixeltrace Posted March 9, 2006 Share Posted March 9, 2006 guys,i need help again,please check [a href=\"http://www.sinagtala.net/sinag3/upcomingmain.php\" target=\"_blank\"]http://www.sinagtala.net/sinag3/upcomingmain.php[/a]notice that the dates are not up to date alreadywhat i mean is at has passed already.what i wanted to happen there iswhen the date is not up to date alreadylet say if the date that is specified there is not from mar9 2006 onwardsthere will be a message saying that"no new updates"this is the script that i used for that page==========<table width="100" border="0" cellspacing="0" cellpadding="0"> <tr> <td> <? include 'db_connect.php'; $uSql = "SELECT event_update, event_image, event_title, event_description, event_imagelink FROM events ORDER by event_date DESC LIMIT 5"; $uResult = mysql_query($uSql, $connection); if(!$uResult){ echo 'no data found';}else{ while($uRow = mysql_fetch_row($uResult)){ $event_imagelink = $uRow[4]; ?> <table width="285" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="5"><img src="images/spacer.gif" width="10" height="5" /></td> </tr> <tr> <td> </td> <td colspan="2" align="left" valign="top"><span class="bodytext"> <?= $uRow[0]?> </span></td> <td width="10" rowspan="3"><img src="images/spacer.gif" width="10" height="10" /></td> </tr> <tr> <td width="10" rowspan="2"><img src="images/spacer.gif" width="10" height="10" /></td> <? if ($uRow[1] == 1) { echo ""; } elseif ($uRow[1] == 2){ echo '<td width="60" rowspan="2" align="center" valign="top">'; echo '<a href="images/events/'.$event_imagelink.'.jpg" target="_blank" class="fotgal"><img src="images/events/thumbs/'.$event_imagelink.'.gif" width="60" height="60" border="0" class="fotgal"></a>'; echo '</td>'; }?> <td width="10" rowspan="2"><img src="images/spacer.gif" width="10" height="10" /></td> <td width="270" align="left"><span class="bodytext3"> <?= $uRow[2]?> </span></td> </tr> <tr> <td align="left"><span class="bodytext1"> <?= $uRow[3]?> </span></td> </tr> <tr> <td colspan="5"><img src="images/spacer.gif" width="10" height="5" /></td> </tr> </table> <? }}?></td> </tr></table>=====================hope you guys can help me with this.thanks in advance!!! Link to comment https://forums.phpfreaks.com/topic/4496-if-else-condition-help/ Share on other sites More sharing options...
littlened Posted March 9, 2006 Share Posted March 9, 2006 [!--quoteo(post=353116:date=Mar 9 2006, 03:05 AM:name=pixeltrace)--][div class=\'quotetop\']QUOTE(pixeltrace @ Mar 9 2006, 03:05 AM) [snapback]353116[/snapback][/div][div class=\'quotemain\'][!--quotec--]guys,i need help again,please check [a href=\"http://www.sinagtala.net/sinag3/upcomingmain.php\" target=\"_blank\"]http://www.sinagtala.net/sinag3/upcomingmain.php[/a]notice that the dates are not up to date alreadywhat i mean is at has passed already.what i wanted to happen there iswhen the date is not up to date alreadylet say if the date that is specified there is not from mar9 2006 onwardsthere will be a message saying that"no new updates"this is the script that i used for that page==========<table width="100" border="0" cellspacing="0" cellpadding="0"> <tr> <td> <? include 'db_connect.php'; $uSql = "SELECT event_update, event_image, event_title, event_description, event_imagelink FROM events ORDER by event_date DESC LIMIT 5"; $uResult = mysql_query($uSql, $connection); if(!$uResult){ echo 'no data found';}else{ while($uRow = mysql_fetch_row($uResult)){ $event_imagelink = $uRow[4]; ?> <table width="285" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="5"><img src="images/spacer.gif" width="10" height="5" /></td> </tr> <tr> <td> </td> <td colspan="2" align="left" valign="top"><span class="bodytext"> <?= $uRow[0]?> </span></td> <td width="10" rowspan="3"><img src="images/spacer.gif" width="10" height="10" /></td> </tr> <tr> <td width="10" rowspan="2"><img src="images/spacer.gif" width="10" height="10" /></td> <? if ($uRow[1] == 1) { echo ""; } elseif ($uRow[1] == 2){ echo '<td width="60" rowspan="2" align="center" valign="top">'; echo '<a href="images/events/'.$event_imagelink.'.jpg" target="_blank" class="fotgal"><img src="images/events/thumbs/'.$event_imagelink.'.gif" width="60" height="60" border="0" class="fotgal"></a>'; echo '</td>'; }?> <td width="10" rowspan="2"><img src="images/spacer.gif" width="10" height="10" /></td> <td width="270" align="left"><span class="bodytext3"> <?= $uRow[2]?> </span></td> </tr> <tr> <td align="left"><span class="bodytext1"> <?= $uRow[3]?> </span></td> </tr> <tr> <td colspan="5"><img src="images/spacer.gif" width="10" height="5" /></td> </tr> </table> <? }}?></td> </tr></table>=====================hope you guys can help me with this.thanks in advance!!![/quote]If I'm understanding what you want to do correctly, then you need to alter your MYSQL SELECT command to something like.$uSql = "SELECT event_update, event_image, event_title, event_description, event_imagelink FROM events WHERE event_date = '$somedate' ORDER by event_date DESC LIMIT 5";then you need to set $somedate as the date you want to search, but remember to do it in the formation of yyyy/mm/dd and set the field in mysql to a date type. Link to comment https://forums.phpfreaks.com/topic/4496-if-else-condition-help/#findComment-15760 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.