MYSQL Error# 1364 |
[eluser]brandonjjon[/eluser]
Hello Everyone, I'm attempting to insert data into my database and the code I wrote is producing this error. I have added the code and the error into this pastie document: http://beta.pastie.org/5426372 I've never had this issue with previous codeigniter applications! Could anyone provide insight on why this is happening? I don't even know why it's telling me anything about an email field. I have no idea why. Kind Regards, Brandon
[eluser]ahmed.alsiddig[/eluser]
hi .. i need more information 2 help do u have email field in database ??
[eluser]brandonjjon[/eluser]
Yes there is an email field in the table. But this is merely code to insert $website into the `websites` field. Nothing about the email field..
[eluser]hungryhippo[/eluser]
When you are inserting in to the database, column 'email' needs a value. Error due to provided no value for this column
[eluser]brandonjjon[/eluser]
But I'm not even wanting to insert any data into this column... I provided a "where" statement to insert it into the correct row. The email field on this particular row is already populated. The goal is to insert $website into the `websites` field.
[eluser]hungryhippo[/eluser]
So you are wanting to update an existing row rather than insert a new one? You will want to use "update" rather than "insert"
[eluser]Aken[/eluser]
[quote author="brandonjjon" date="1353799334"]But I'm not even wanting to insert any data into this column... I provided a "where" statement to insert it into the correct row. The email field on this particular row is already populated. The goal is to insert $website into the `websites` field.[/quote] When you created the email column, you specified that it must have a value (aka NOT NULL). You need to provide a default value when doing inserts, even if you don't want to add a value, OR modify the database column to accept null values.
[eluser]PhilTem[/eluser]
You can't perform an insert with a where. The only thing you can do is updating or deleting a row with a where statement. So you either want this code Code: $data = array( or this code Code: $data = array( Yet guessing from your post you want to use the second code snippet. |
Welcome Guest, Not a member yet? Register Sign In |