Erfan Sharafzadeh
Erfan Sharafzadeh

Reputation: 59

Ignoring "//" in mysql query

I have a simple mysql query like this:

INSERT INTO ftpt VALUES (0,ftp://ftp.somewhere.com);

As you see, there is "//" in my code which i dont know how to make mysql ignore that, altough it may seem silly to you , I couldnt find anything nowhere. Thank you for your help.

Upvotes: 0

Views: 43

Answers (3)

RGK
RGK

Reputation: 40

your query almost right, your just missing single quotes you should try this like this:

INSERT INTO ftpt VALUES (0,'ftp://ftp.somewhere.com');

Upvotes: 1

user330315
user330315

Reputation:

String literals must be enclosed in single quotes (as documented in the manual) (Note that using double quotes is non-standard SQL and will not work on other standard-compliant databases. So it's best to always use single quotes)

INSERT INTO ftpt VALUES (0, 'ftp://ftp.somewhere.com'); 

It's also good coding style to explicitly state the columns of the table:

INSERT INTO ftpt (id, url) VALUES (0, 'ftp://ftp.somewhere.com'); 

Upvotes: 3

slavik
slavik

Reputation: 1303

Simply add apostrophe

INSERT INTO ftpt VALUES (0,'ftp://ftp.somewhere.com');

Upvotes: 1

Related Questions