El box El box -5 years ago 161
SQL Question

is_numeric() in mysql_fetch_assoc

Hello i'm trying to check is a value of

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 Source

Try this:

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

the if condition have no bracket

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download