php - Help resolving SQL error that occurs in code but not in SQL workbench -
i run command in sql workbench , returns desired results, return syntax error in browser...
$sql = "select substring(`last_name`, 1, 1) alpha, substring(`middle_name`, 1, 1) submiddlename, `idclients`, `type`, `first_name`, `middle_name`, `last_name`, `address`, `primary_number`, `secondary_number`, `home_number`, `office_number`, `cell_number`, `fax_number`, `ext_number`, `other_number`, `comments` `clients` `user_id` = 2 , `is_sub` = 0 , `prospect` = 1 order `last_name`";
also user_id
, is_sub
, , prospect
of int data type if wants know. tried treat them strings in query, still didn't help.
this error get
you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'and
prospect
= 1 ,type
= 'buyer'' @ line 1
you're not showing same query, or relevant php code, above query use string 'buyer'
.
that said, may need escape column name type
backticks:
and `prospect` = 1 , `type` = 'buyer'
Comments
Post a Comment