Re: mysql_result .. what am i doing wrong ?

From: Date: Wed, 06 Sep 2000 06:11:38 +0000
Subject: Re: mysql_result .. what am i doing wrong ?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-15451@lists.php.net to get a copy of this message
I tried SELECT UNIX_TIMESTAMP('2000-6-12') at the command line and it worked OK, but the if($d=mysql_result($r,0,'testdate') > 0) part looks funny to me I'd try: $d=mysql_result($r,0,'testdate'); if($d>0){ do other stuff... } Russell ----- Original Message ----- From: Pete Lancashire <petel@pdxeng.com> To: <php-general@lists.php.net> Sent: Tuesday, September 05, 2000 9:59 PM Subject: [PHP] mysql_result .. what am i doing wrong ? > I stole this from the check_date annotations but > mysql_result always returns a 1, not the result of the select. > > Must be something really simple .. > > $r = mysql_db_query("mydatabase", "SELECT > UNIX_TIMESTAMP('2000-6-12') as > testdate"); > if($d=mysql_result($r,0,'testdate') > 0) { > > $fname = mysql_field_name($r,0); <--test to verify field name > echo "fname:" . $fname . "<br>"; > > echo "d:". $d . "<br>"; <--- always 1 > echo date(" n F Y", $d) . "<br>"; > } > > TIA, > > -pete > > petel@pdxeng.com > > > -- > 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 (#15451) next »