MySQL Forums
Forum List  »  PHP

PHP - MySQL Error
Posted by: Ethan Hunte
Date: March 28, 2009 04:59AM

Hello People

I wonder if anyone could help me with this problem.

I am trying to run a formcheck error which looks for the user specified zone ($zone) in a table ($zones_table) to see if a row exists and my code is as follows :

if ( !defined('FRMCHK_USER') ) { die("Access Denied"); }

$fv = new formchecker;


$inner = substr($zone, -3, 3);
$outer= substr($zone, 0, (strlen($zone)- 3));

$is_zone = $db->count_rows('zones_table', "WHERE outer='" . $outer . "'");

if ($is_zone == 0)
$fv->error_list[] = array('value' => $user_zone, 'msg' => MSG_NO_ZONE . ' (<b>' . $user_zone . '</b>)');

That said, I am getting a MYSQL error with the count_rows line. And I cannot work out why. Any help would be appreciated. The error code is as follows :

The query you are trying to run is invalid
Mysql Error Output: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'outer='ZA5'' at line 1
SQL Query: SELECT count(*) AS count_rows FROM zones_table WHERE outer='ZA5'

Many thanks in advance


Options: ReplyQuote

Written By
PHP - MySQL Error
March 28, 2009 04:59AM
March 28, 2009 06:03AM
March 28, 2009 06:20AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.