MySQL Forums
Forum List  »  Newbie

Same QUERY not working on PHP and works in MySQLWorkbench
Posted by: Michal Mular
Date: June 23, 2023 05:36AM

Dear Forum

I have an automatic genereted SLQ query, which i try to use via connection from PHP script with error:

ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CREATE TABLE reservation_week (id_reservation_week int(11) NOT NULL AUTO_INCR...' at line 1

Query generated by code:
USE mmike_devtest;
CREATE TABLE reservation_week (
id_reservation_week int(11) NOT NULL AUTO_INCREMENT,
reserved int(1) DEFAULT NULL,
idcustomer int(11) DEFAULT NULL,
person_qty int(2) DEFAULT NULL,
cleaning int(1) DEFAULT NULL,
reservation_code varchar(5) DEFAULT NULL,
PRIMARY KEY (id_reservation_week))
ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

When i paste this query to MySQL Workbench it works fine.
WHere could be the problem?

Thank you in advance
Michal

Options: ReplyQuote


Subject
Written By
Posted
Same QUERY not working on PHP and works in MySQLWorkbench
June 23, 2023 05:36AM


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.