Can't figure out what's wrong with my php/sql statement

Posted by Olegious on Stack Overflow See other posts from Stack Overflow or by Olegious
Published on 2010-05-13T04:39:31Z Indexed on 2010/05/13 4:44 UTC
Read the original article Hit count: 129

Filed under:
|

So this is probably a dumb beginner question, but I've been looking at it and can't figure it out. A bit of background: just practicing making a web app, a form on page 1 takes in some values from the user, posts them to the next page which contains the code to connect to the DB and populate the relevant tables.

I establish the DB connection successfully, here's the code that contains the query:

$conn->query("SET NAMES 'utf9'");         

$query_str = "INSERT INTO 'qa'.'users' ('id', 'user_name','password' ,'email' ,'dob' ,'sx') VALUES (NULL, $username, $password, $email, $dob, $sx);";

$result = @$conn->query($query_str);

Here's the error that is returned:Insert query failed: 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 ''qa'.'users' ('id', 'user_name' ,'password' ,'email' ,'dob' ,'s' at line 1

Thanks in advance!

© Stack Overflow or respective owner

Related posts about php

Related posts about sql