Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6981545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:10:15+00:00 2026-05-27T18:10:15+00:00

I got an error while creating a table in php with mysql database, and

  • 0

I got an error while creating a table in php with mysql database, and I tried testing directly on mysql query engine it works fine. whereas in php code it gives below error

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.

Below is the code I am writing

$query14 = mysql_query("create table $tablename (
                                           project_id INT,
                                           project_client_id INT, 
                                           project_partner_id INT, 
                                           project_manager_id INT,
                                           project_employees INT, 
                                           project_name VARCHAR(500), 
                                           project_status TEXT,
                                           project_summary LONGTEXT, 
                                           project_order INT, 
                                           project_start_date DATETIME,
                                           project_end_date DATETIME
                                         ) ENGINE = INNODB;");

and below is the image attached and table structure should be and this is the sample table i create using with phpmyadmin interface.
And below is the full error

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 ''8' (project_id INT, project_client_id INT, project_partner_id INT, project_mana' at line 1`

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T18:10:17+00:00Added an answer on May 27, 2026 at 6:10 pm

    I didn’t see any problem with your query. But what is the value of $tablename? Two error possibilities here :

    1. The variable $tablename is empty.
    2. $tablename is a key-word.

    Please check the above two otherwise its all right.

    UPDATE :

    As per your updated question please try with the following code. I think it will help you.

    $query14 = mysql_query("create table `$tablename` (
                                               `project_id` INT,
                                               `project_client_id` INT, 
                                               `project_partner_id` INT, 
                                               `project_manager_id` INT,
                                               `project_employees` INT, 
                                               `project_name` VARCHAR(500), 
                                               `project_status` TEXT,
                                               `project_summary` LONGTEXT, 
                                               `project_order` INT, 
                                               `project_start_date` DATETIME,
                                               `project_end_date` DATETIME
                                             ) ENGINE = INNODB;");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

in DB2 while executing a query i got SqlException: DB2 SQL Error: SQLCODE=-668, SQLSTATE=57016
GOT error for the following query in MYSQL(version5.1) SELECT year,month,sum(fact_1),sum(fact_2),sum(fact_3),sum(fact_4) from( select year,month,fact_1,fact_2,0 as
I got an error today while trying to do some formatting to existing code.
I got this error An error occurred while parsing EntityName. Line 1, position 61.
i got 'JQuery' is undefined error while browsing the page in IE 6 but
I got RJS error: TypeError: element is null while using ajax. I used in
While trying to generate classes from a xsd, i got this error: java.lang.IllegalArgumentException: Illegal
I am new to maven, while using mvn install I've got this error, any
While working on an existing project I suddenly got the following error when trying
I have got an error while trying to upgrade our large project to SL4.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.