How to fix the following SQL error?

1You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`Sent`, `handler` varchar(20) NOT NULL, PRIMARY KEY (`id`) )' at line 5

Code:

$create_q = 'CREATE TABLE IF NOT EXISTS `'.$job_id.'`(
                  `id` int(11) NOT NULL auto_increment,
                  `mobile` bigint(20) NOT NULL,
                  `routeID` int(11) NOT NULL,
                  `status` varchar(20) NOT NULL default `Sent`, `handler` varchar(20) NOT NULL,
                  PRIMARY KEY  (`id`)
                ) ';

Recommended Answers

All 2 Replies

Member Avatar for diafol

What is sent ? A field? or a mistake? If it's a default value use quotes (you may need to escape them) instead of backticks.

BTW - good original title heh heh

The default Sent needs to say default 'Sent', easy way to remember is that text stuff needs single quotes in SQL.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.