PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, February 22, 2022

[FIXED] trying to import sql fle , but facing this error

 February 22, 2022     mysql, php, phpmyadmin, xampp     No comments   

Issue

This is the error on cmd prompt:
C:\xampp\mysql\bin>mysql -p -u root --default_character_set utf8 recipes < recipes.sql
Enter password: ****

ERROR 1064 (42000) at line 20: 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 '"admin" (
  "admin_id" int(10) NOT NULL,
  "f_name" text NOT NULL,
  "l_name" te' at line 1

This is the error when I try to import on phpmyadmin `Error Static analysis:

4 errors were found during analysis.

A symbol name was expected! (near ""admin_id"" at position 383)
At least one column definition was expected. (near ""admin_id"" at position 383)
Unexpected beginning of statement. (near "20" at position 398)
Unrecognized statement type. (near "NOT NULL" at position 402)
SQL query:

-- phpMyAdmin SQL Dump -- version 4.8.3. -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: August 29, 2018 at 09:56 AM -- Server version: 5.1.37 -- PHP Version: 7.2.9 -- -- Database: `recipes` -- -- -------------------------------------------------------- -- -- Table structure for table `admin` -- CREATE TABLE IF NOT EXISTS "admin" ( "admin_id" int(20) NOT NULL, "f_name" text NOT NULL, "l_name" text NOT NULL, "email" varchar(250) NOT NULL, "c_email" varchar(250) NOT NULL, "pass" varchar(250) NOT NULL, "c_pass" varchar(250) NOT NULL, "u_name" varchar(150) NOT NULL, "address" text NOT NULL, "date_of_birth" varchar(50) NOT NULL, "city" text NOT NULL, "state" text NOT NULL, "country" text NOT NULL, "gender" text NOT NULL, "p_o" int(50) NOT NULL, PRIMARY KEY ("admin_id") ) AUTO_INCREMENT=1

MySQL said: Documentation

1064 - 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 '"admin" (

"admin_id" int(20) NOT NULL, "f_name" text NOT NULL, "l_name"' at line 20this is my code`


Solution

remove ""

this should be the query

CREATE TABLE IF NOT EXISTS admin 
( 
    admin_id int(20) NOT NULL, 
    f_name text NOT NULL, 
    l_name text NOT NULL, 
    email varchar(250) NOT NULL, 
    c_email varchar(250) NOT NULL, 
    pass varchar(250) NOT NULL, 
    c_pass varchar(250) NOT NULL, 
    u_name varchar(150) NOT NULL, 
    address text NOT NULL, 
    date_of_birth varchar(50) NOT NULL, 
    city text NOT NULL, 
    state text NOT NULL, 
    country text NOT NULL, 
    gender text NOT NULL, 
    p_o int(50) NOT NULL, 
    PRIMARY KEY (admin_id) 
) AUTO_INCREMENT=1


Answered By - Jeffrey
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing