Here's the complete deal:
$query1="SELECT id,cat_id,active,title,primary_image,image_1,image_1_thumb,image_2,image_2_thumb,image_3,image_3_thumb,image_4,image_4_thumb,image_5,image_5_thumb,image_6,image_6_thumb,DATE_format(create_date, '%b %e, %Y') as create_date,DATE_format(end_date, '%b %e, %Y') as end_date FROM classifieds_ads WHERE user_id=$user_id ORDER BY end_date DESC";
$result1=mysql_query($query1) or die (mysql_error());
$numr=mysql_num_rows($result1);
if($numr==0){
echo("<p>You currently have no advertisements. If you would like to create an advertisement, simply
click the \"create an ad\" in the quick link section at the bottom of this page.</p>");
}else{
echo("
<hr width='100%'>
");
/*Show the user's ads*/
while($row=mysql_fetch_array($result1)){
$id=$row['id'];
$cat_id=$row['cat_id'];
$active=$row['active'];
$full_title=$row['title'];
$title=strtruncate($full_title, 20, " ");
$primary_image=$row['primary_image'];
$image_1=$row['image_1'];
$image_1_thumb=$row['image_1_thumb'];
$image_2=$row['image_2'];
$image_2_thumb=$row['image_2_thumb'];
$image_3=$row['image_3'];
$image_3_thumb=$row['image_3_thumb'];
$image_4=$row['image_4'];
$image_4_thumb=$row['image_4_thumb'];
$image_5=$row['image_5'];
$image_5_thumb=$row['image_5_thumb'];
$image_6=$row['image_6'];
$image_6_thumb=$row['image_6_thumb'];
$create_date=$row['create_date'];
$end_date=$row['end_date'];
$query2="SELECT title,parent FROM classifieds_categories WHERE id=$cat_id";
$result2=mysql_query($query2) or die (mysql_error());
while($row=mysql_fetch_array($result2)){
$cat_title=$row['title'];
$parent=$row['parent'];
$query3="SELECT title FROM classifieds_categories WHERE id=$parent";
$result3=mysql_query($query3) or die (mysql_error());
while($row=mysql_fetch_array($result3)){
$parent_title=$row['title'];
}
}
echo("
<table width='100%'>
<tr>
<td width='100'>
<img src='/uploaded_images/".$thumbnail."' alt='thumbnail'>
</td>
<td width='10'>
</td>
<td valign='top'><b>Title: <a href='classifieds.php?action=view_ad&ad_id=".$id."' alt='".$full_title."' title='".$full_title."'>".$full_title."</a><br>
");
if($active=='1'){
echo("<b><font color='green'>ACTIVE</font></b>");
if($end_date<<NOW()){
echo(" <b><font color='red'>BUT EXPIRED</font></b>");
}
}else{
echo("<b><font color='red'>INACTIVE</font></b>");
if($end_date<<NOW()){
echo(" <b><font color='red'>AND EXPIRED</font></b>");
}
}
echo("
Found In: ".$parent_title."~>".$cat_title."<br>
Ends On: ".$end_date."</b><br />
<b>| <a href='' alt='Renew this ad'>Renew</a> -|- <a href='' alt='Edit this ad'>Edit</a> -|- <a href='' alt='Deactivate this ad'>Deactivate</a> -|- <a href='' alt='Delete this ad'>Delete</a> |</b>
</td>
</tr>
</table>
<br />
<hr width='100%'>
");
}
echo("
");
}
}
}
If you look at the "BUT EXPIRED" and "AND EXPIRED" portion of the code, you'll see where I'm stuck.
thanks,
json