El box El box - 5 months ago 8
SQL Question

is_numeric() in mysql_fetch_assoc

Hello i'm trying to check is a value of

mysql_fetch_assoc($query)
a numeric. But getting an error:


Parse error: syntax error, unexpected T_STRING, expecting '(' in /var/www/xmlexport/run/test.php on line 53


Im using:

while($values_query = mysql_fetch_assoc($query))


Line 53 is:

if is_numeric($values_query['row5']) { $testt = round(($values_query['row5']), 2); } else { $testt = 'hello'; }

Answer

Try this:

 if (is_numeric($values_query['row5'])) { $testt = round(($values_query['row5']), 2); } else { $testt = 'hello'; }

the if condition have no bracket

Comments