Re: PHP Mysql query data conversion newbie

From: Date: Wed, 09 May 2001 16:27:23 +0000
Subject: Re: PHP Mysql query data conversion newbie
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-52136@lists.php.net to get a copy of this message
Can I set this to check any of the cells ?? if ($amyrow["any cell"] == "0000-00-00 00:00:00") { echo "no date"; ----- Original Message ----- From: "Jon Haworth" <JHaworth@witanjardine.co.uk> To: "'Andras Kende'" <info@kende.com>; <php-general@lists.php.net> Sent: Wednesday, May 09, 2001 9:09 AM Subject: RE: [PHP] PHP Mysql query data conversion newbie > 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:info@kende.com] > Sent: 28 April 2001 17:01 > To: php-general@lists.php.net > 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: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > ********************************************************************** > '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: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#52136) next »