MySQL Forums
Forum List  »  PHP

prepared statement syntax problem
Posted by: Dimitris Papageorgiou
Date: September 08, 2015 05:58AM

I have this query:
select u.name,u.lastname,t.user_type
from users u
join business_users b on u.user_id=b.crid
join buz_usertype t on b.bus_user_type=t.type_id
where u.lastname like 'P%';

It works on Netbeans console...but when run in a PHP script in a prepared statement it does not:

if($stmt = $connection->prepare('select u.name,u.lastname,t.user_type
from users u
join business_users b on u.user_id=b.crid
join buz_usertype t on b.bus_user_type=t.type_id
where u.lastname like=?%'))

I get this message...related to the syntax:
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 '=?%' at line 5,

What possible can be wrong here?

Options: ReplyQuote


Subject
Written By
Posted
prepared statement syntax problem
September 08, 2015 05:58AM


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.