Well, it's not immediately obvious whether your date is in "i", "j", or "f",
so let's pretend it's in "date" :-)

Try this:
while($amyrow = mysql_fetch_array($aresult))
        {
          echo "</td><td><font face=verdana size=1>";
                 echo $amyrow["i"];
           echo "</td><td><font face=verdana size=1>";
                 echo $amyrow["j"];
           echo "</td><td><font face=verdana size=1>";
                 echo $amyrow["f"];
           echo "</td><td><font face=verdana size=1>";
           if ($amyrow["date"] == "0000-00-00 00:00:00") {
                 echo "no date";
           } else {
                 echo $amyrow["date"];
           }
           echo "</td>";
        }
}

HTH
Jon




-----Original Message-----
From: Andras Kende [mailto:[EMAIL PROTECTED]]
Sent: 28 April 2001 17:01
To: [EMAIL PROTECTED]
Subject: [PHP] PHP Mysql query data conversion newbie


Hello,

I pull some data from mysql with the php code below.
On the date field if there is no date on mysql it displays : 0000-00-00
00:00:00

I would like to change this 0000-00-00 00:00:00 to "no date" for example..

Or if the cel is empty to " " (because otherwise the tableborders are messed
up)

I tried to put an if statement inside the while {} but i cannot figured
out...


Thank You,

Andras



{$aresult=mysql_query("select * from media where d like '$city' order by i"
,$db);}

while($amyrow = mysql_fetch_array($aresult))
        {
          echo "</td><td><font face=verdana size=1>";
                 echo $amyrow["i"];
           echo "</td><td><font face=verdana size=1>";
                 echo $amyrow["j"];
           echo "</td><td><font face=verdana size=1>";
                 echo $amyrow["f"];
           echo "</td>";
        }


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



**********************************************************************
'The information included in this Email is of a confidential nature and is 
intended only for the addressee. If you are not the intended addressee, 
any disclosure, copying or distribution by you is prohibited and may be 
unlawful. Disclosure to any party other than the addressee, whether 
inadvertent or otherwise is not intended to waive privilege or
confidentiality'

**********************************************************************

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to