Jump to content

if else condition help


pixeltrace

Recommended Posts

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 already
what i mean is at has passed already.
what i wanted to happen there is
when the date is not up to date already
let say if the date that is specified there is not
from mar9 2006 onwards
there 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>&nbsp;</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
Share on other sites

[!--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 already
what i mean is at has passed already.
what i wanted to happen there is
when the date is not up to date already
let say if the date that is specified there is not
from mar9 2006 onwards
there 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>&nbsp;</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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.