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 4076138
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:23:13+00:00 2026-05-20T17:23:13+00:00

Let me try this again, because I’m not sure people got that I was

  • 0

Let me try this again, because I’m not sure people got that I was running this query with php. The query that the php function outputs runs fine in a regular mySQL program like Navicat but it throws this error, in my browser when it ran from the php script:

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 'DROP TABLE IF EXISTS checklisttest; CREATE TABLE checklisttest ( Incident va' at line 2

Here is some of the query that is ran from within the php script:

    SET FOREIGN_KEY_CHECKS=0;
DROP TABLE IF EXISTS checklisttest;
CREATE TABLE checklisttest (
  Incident varchar(12) NOT NULL,
  TestID mediumint(9) NOT NULL AUTO_INCREMENT,
  Element varchar(12) NOT NULL,
  Name varchar(128) NOT NULL,
  Code varchar(512) NOT NULL,
  Expected varchar(512) NOT NULL,
  Actual varchar(512) NOT NULL,
  AutoVerifyResult varchar(32) NOT NULL,
  QAResult varchar(32) DEFAULT NULL,
  Comments text,
  PRIMARY KEY (TestID)
);

INSERT INTO `checklistTest` VALUES ('20009',NULL,'E02_04','Type of Service Requested','30','911 Response (Scene)','911 RESPONSE (SCENE)','100','Pass',NULL);
INSERT INTO `checklistTest` VALUES ('20009',NULL,'E02_11','EMS Unit/Vehicle  Number','Medic 81','Medic 81','Medic 81','100','Pass',NULL);
INSERT INTO `checklistTest` VALUES ('20009',NULL,'E02_18','Patient Destination  Odometer Reading  of Responding  Vehicle','11','11','Not set!','0','Fail',NULL);
INSERT INTO `checklistTest` VALUES ('20009',NULL,'E03_01','Complaint Reported  by Dispatch','410','Animal Bite','ANIMAL BITE','100','Pass',NULL);
INSERT INTO `checklistTest` VALUES ('20009',NULL,'E04_01','Crew Member ID','EMT302875','EMT302875','EMT302875','100','Pass',NULL);
INSERT INTO `checklistTest` VALUES ('20009',NULL,'E04_01','Crew Member ID','PMD509465','PMD509465','PMD509465','100','Pass',NULL);

Here is the php that generates that query:

        private function toDB(){
        $sql = "
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE IF EXISTS checklisttest;
CREATE TABLE checklisttest (
  Incident varchar(12) NOT NULL,
  TestID mediumint(9) NOT NULL AUTO_INCREMENT,
  Element varchar(12) NOT NULL,
  Name varchar(128) NOT NULL,
  Code varchar(512) NOT NULL,
  Expected varchar(512) NOT NULL,
  Actual varchar(512) NOT NULL,
  AutoVerifyResult varchar(32) NOT NULL,
  QAResult varchar(32) DEFAULT NULL,
  Comments text,
  PRIMARY KEY (TestID)
);
              ";

    //iterate through the records $this->records[10001]
    foreach($this->records as $inc => $record){
        //iterate through the element ids $this->records[10001][E02_04]
        foreach($this->records[$inc]["Elements"] as $elementID => $element){
            //iterate through the element ids $this->records[10001][E02_04][1]
            foreach($element as $key => $val){
                $sql .= "
INSERT INTO `checklistTest` VALUES (\"$inc\",NULL,\"$elementID\",\"$val[name]\",\"$val[code]\",\"$val[expected]\",\"$val[actual]\",\"$val[match]\",\"$val[QAResult]\",NULL);";
            }
        }
    }
    echo "<textarea style='width:100%;height:400px'>$sql</textarea>";
    mysql_select_db("new",$GLOBALS['local']);
    mysql_query($sql,$GLOBALS['local']) or die(mysql_error());
}
  • 1 1 Answer
  • 3 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-20T17:23:14+00:00Added an answer on May 20, 2026 at 5:23 pm

    You must specify length for each varchar field. Moreover you have two auto_increment fields

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry, I completely neglected to mention that I'm using Python. Let me try this
Let me try this again, I'm going to leave out the exact data/example and
EDIT : Let's try this again. This time I've used the AdventureWorks sample database
There's a lot of conflicting information about this topic. So let's try to agree
Let me try to explain what I need. I have a server that is
Alright so I have a task, that I have to let the client try
I'm going to try to explain this in simple terms, because it's probably shorter
Let me try to explain it. Please tell me if I am wrong. I
Let's say I do something in Java like: RemoteResponse response = null; try {
WCF service has one method ( Let's say TestMethod) in which I try to

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.