6 Replies - 2215 Views - Last Post: 16 June 2013 - 07:01 PM

Not understanding syntax error: 1064 looked it over and seems fine

Posted 15 June 2013 - 07:46 PM

I may not be understanding how to do this but I am receiving a syntax error that makes no sense and I look it over and cannot find anything. As I am trying to learn code I may not be putting everything in best practice so you'll have to excuse me. At the very bottom I am providing the full code.

I am receiving "Database Error: unable to create record.1064You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'pccharacters.id = '4'' at line 4"

When it is not even close to line 4. It is also a second query. The goal is to transfer the character id to a many-to-many database once the character (and it's respective id) is created. I will be replacing the hard numbers in the mysql query to mysqli_insert_id($mysqli) as I believe that is how to pull the auto increment id.

Let me know if there is any further clarification needed.

$query1 = "INSERT playerskill
SET
skillid = '3'
charid = '4'

My questions (are a few) but the main one is why am I receivign a syntax error? Could it be how I inner joined them?

Re: Not understanding syntax error: 1064 looked it over and seems fine

Posted 15 June 2013 - 08:03 PM

BTW If you perform all your real-escape processing separately, before creating the sql-statements, it will make them much easier to read. I would look into using array_map to do this on the $_POST array in one go if possible.

Re: Not understanding syntax error: 1064 looked it over and seems fine

Posted 16 June 2013 - 07:01 PM

That was my bad I started with a page that was for editing the information first and so I left the comment as it was because I wasn't thinking. Cardinal rule broken. I did change it to something closer to an array as the set I've read can be picky??