Home > Software design >  sql unable to insert
sql unable to insert

Time:01-10

im trying to insert some data into a table, mysql gives syntax error and i cant find, may i get help please

INSERT INTO museums(id,name,rate,phone,opening_hours,closing_hours,location,image)
VALUES(1,"The Royal Automobile Museum",4.7,065411392,10:00:00, 7:00:00,"At Tibbiyya, Amman",LOAD_FILE('C:\xampp\htdocs\wael\images\The Royal Automobile Museum.jpg'));
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 ':00:00, 7:00:00,"At Tibbiyya, Amman",LOAD_FILE('C:\xampp\htdocs\wael\images\T...' at line 2

CodePudding user response:

try this one:

INSERT INTO museums (id,name,rate,phone,opening_hours,closing_hours,location,image) VALUES (1,'The Royal Automobile Museum',4.7,065411392,'10:00:00','7:00:00','At Tibbiyya, Amman','LOAD_FILE(''C:\xampp\htdocs\wael\images\The Royal Automobile Museum.jpg'')');

It gives error probably due to ' mark before C:/// and after jpg. so you need to change it to '' instead of '

CodePudding user response:

use ' for hours and phone

insert into museums
    (
       id
     , name
     , rate
     , phone
     , opening_hours
     , closing_hours
     , location
     , image
    )
    values
    (1
    , 'The Royal Automobile Museum'
    , 4.7
    , '065411392'
    , '10:00:00'
    , '7:00:00'
    , 'At Tibbiyya, Amman'
    , LOAD_FILE('C:\xampp\htdocs\wael\images\The Royal Automobile Museum.jpg'))
  •  Tags:  
  • Related