![]() Topic awaiting preservation: Textarea to SQL (Page 1 of 1) |
|
---|---|
Nervous Wreck (II) Inmate From: |
![]() Hmmm very simple question but kinda stumped... Basically I have a textarea in a form that i'm trying to insert into sql the information consists of multiple paragraphs: |
Maniac (V) Mad Scientist From: :morF |
![]() Uhh... you've got a test field, and you're just trying to insert it straight into an SQL statement to be executed on your database? I'd suggest, if this is the case, that you spend some time looking into "SQL Injection" and why this is definitely a bad thing. |
Nervous Wreck (II) Inmate From: |
![]() oh sorry sorry... i do have the rest of the code: |
Maniac (V) Mad Scientist with Finglongers From: Germany |
![]() so... what's the actual output of php->mysql_error() |
Nervous Wreck (II) Inmate From: |
![]() well there's no error but the insert doesn't go in |
Maniac (V) Mad Scientist From: :morF |
![]() If it reaches a condition of die() then there should be a message waiting in mysql_error. Change your function line to look like this: code: mysql_query($query) or die("Error in query $query: ".mysql_error());
|
Bipolar (III) Inmate From: you tell me |
![]() The last time I had such a problem was when the insert query had teh wrong number of elements. Did you double check that just in case... |
Maniac (V) Mad Scientist with Finglongers From: Germany |
![]() some error checking might help as well |
Nervous Wreck (II) Inmate From: |
![]() yup seemed to be the problem... I created too many fields when i created the table sorry |
Maniac (V) Mad Scientist From: Denver, CO, USA |
![]() For what it's worth, whenever you're developing a dynamic site, it's a good idea to manage your error handling. FAR too many times I've come across dynamic sites that, upon breaking in this that or the other thing, I get something that tells me what fields are being modified in the table, the table name, the data structure--more than enough for me to use to break the system on purpose. |
Maniac (V) Mad Scientist with Finglongers From: Germany |
![]() and learn sql - you should always use insert into table (field,field,field) VALUES ( '','',''), to guard against schema changes. |