Topic awaiting preservation: Textarea to SQL |
|
---|---|
Author | Thread |
Nervous Wreck (II) Inmate From: |
posted 05-05-2007 14:00
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 |
posted 05-05-2007 16:36
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: |
posted 05-05-2007 23:11
oh sorry sorry... i do have the rest of the code: |
Maniac (V) Mad Scientist with Finglongers From: Germany |
posted 05-05-2007 23:50
so... what's the actual output of php->mysql_error() |
Nervous Wreck (II) Inmate From: |
posted 05-06-2007 10:17
well there's no error but the insert doesn't go in |
Maniac (V) Mad Scientist From: :morF |
posted 05-06-2007 10:31
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 |
posted 05-07-2007 13:47
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 |
posted 05-07-2007 16:19
some error checking might help as well |
Nervous Wreck (II) Inmate From: |
posted 05-07-2007 22:08
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 |
posted 05-08-2007 18:44
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 |
posted 05-09-2007 10:04
and learn sql - you should always use insert into table (field,field,field) VALUES ( '','',''), to guard against schema changes. |