Jump to content

Archived

This topic is now archived and is closed to further replies.

AncientSage

Inserting variables into SQL?

Recommended Posts

Hello,

I'm attempting to put variables into a column, but it appears to be giving me problems:

[code]
INSERT INTO file (id, song_filename, song_name, song_author, song_genre) VALUES ('', $file, $name, $type, $description);
[/code]

Yeah, it's telling me "unknown column *putvalueof$filehere* in"

It's thinking the variables are columns, how would I get around this?

Share this post


Link to post
Share on other sites
If they are string variables you need to enclose them in quotes.
[code]
INSERT INTO file (id, song_filename, song_name, song_author, song_genre) VALUES ('', '$file', '$name', '$type', '$description');
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.