-2

In Ci I'm getting the following error:

A Database Error Occurred

Error Number: 1064

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 '', '1f37540fc54292b018a9e993da38cb5647dc5587', NOW(), '0')' at line 1

INSERT INTO users (userpid, Email, Password, dateTimeRegistered, isLeader) VALUES ('147344f0e33367f9e6', erf', '1f37540fc54292b018a9e993da38cb5647dc5587', NOW(), '0')

Filename: C:\Workspace\htdocs\Misc-2\DruvlaCi-1\system\database\DB_driver.php

Line Number: 330

But everything seems to be right in the SQL query. Below is my query, any thoughts?

$query = $this->db->query("INSERT IGNORE INTO users (userpid, Email, Password, dateTimeRegistered, isLeader) VALUES ('{$idgen}', {$postedEmail}', '{$hashedPass}', NOW(), '0')");

2 Answers 2

3

You're forgetting the opening single quote for the email column

Try this instead

$query = $this->db->query("INSERT IGNORE INTO users (userpid, Email, Password, dateTimeRegistered, isLeader) VALUES ('{$idgen}', '{$postedEmail}', '{$hashedPass}', NOW(), '0')");
Sign up to request clarification or add additional context in comments.

Comments

1

Uhm, and please, use this syntax for inserting instead:

http://codeigniter.com/user_guide/database/active_record.html#insert

works so much safer.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.