I want to enter multiple checkbox values for parent_history field...for that i have created table...and did php code for inserting value in table...but it shows the Insertion Failed:error....i am not getting what is going wrong?? ,...
my code - <label>Asthma / Lung Problems</label>
-
<input name="parent_history[]" type="checkbox" ckbox" value="Asthma / Lung Problems" tabindex="7" />
-
<label>Cancer</label>
-
<input name="parent_history[]" type="checkbox" value="Cancer" tabindex="8" />
-
-
$media_array = serialize($_POST['parent_history']);
-
-
$current_symptoms_array = serialize($_POST['current_symptoms']);
-
-
$sql_insert = "INSERT into `healthinfo`
-
(`member_id`, `full_name`, `age`, `height`, `weight`, `waist`, `forearms`, `biceps`, `hip`, `chest`, `parent_history`, `current_symptoms`, `tobacco`, `drugs`, `alcohol`, `outside_food`, `exercise`)
-
VALUES
-
('$_SESSION[user_id]','$_SESSION[user_name]',$_POST[age]','$_POST[height]','$_POST[weight]','$_POST[waist]','$_POST[forearms]','$_POST[biceps]','$_POST[hip]','$_POST[chest]','$media_array'
-
,'$current_symptoms_array','$_POST[tobacco]','$_POST[drugs]','$_POST[alcohol]','$_POST[outside_food]','$_POST[exercise]'";
-
mysql_query($sql_insert,$link) or die("Insertion Failed:" . mysql_error());
1 1139
there are several SQL syntax errors. I’ll post your SQL with added indenting, maybe you can spot the errors yourself. - $sql_insert = "
-
INSERT into `healthinfo`
-
(
-
`member_id`,
-
`full_name`,
-
`age`,
-
`height`,
-
`weight`,
-
`waist`,
-
`forearms`,
-
`biceps`,
-
`hip`,
-
`chest`,
-
`parent_history`,
-
`current_symptoms`,
-
`tobacco`,
-
`drugs`,
-
`alcohol`,
-
`outside_food`,
-
`exercise`
-
)
-
VALUES
-
(
-
'$_SESSION[user_id]',
-
'$_SESSION[user_name]',
-
$_POST[age]',
-
'$_POST[height]',
-
'$_POST[weight]',
-
'$_POST[waist]',
-
'$_POST[forearms]',
-
'$_POST[biceps]',
-
'$_POST[hip]',
-
'$_POST[chest]',
-
'$media_array',
-
'$current_symptoms_array',
-
'$_POST[tobacco]',
-
'$_POST[drugs]',
-
'$_POST[alcohol]',
-
'$_POST[outside_food]',
-
'$_POST[exercise]'
-
";
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Sascha |
last post by:
Hi
I need some help on achieving the following:
I wrote a querie which collects Data out of three Tables, the Result
looks like this:
SET NOCOUNT ON
DECLARE @ROW INT
|
by: Jim G |
last post by:
I have two tables: TestA and TestB. Both tables have 3 fields: ID,
Name, and RunDate. I need to create a query which will join the two
tables first on Name but then I need to match up the...
|
by: cainlevy |
last post by:
I'm wondering if there's any way to speed up create table queries?
Besides upgrading hardware, that is. The very simplest table creation
query, "create table table1 ( field1 INT(10))" is taking...
|
by: Alicia |
last post by:
Does anyone know why I am getting a "Syntax error in Create Table
statement". I am using Microsoft Access SQL View to enter it. Any
other problems I may run into?
CREATE TABLE weeks
(...
|
by: Philehof |
last post by:
Hi Group.
I would like to add some information to a query.
I tried to create a table with the information from the query but then
if i run the query again the additional data will be lost.
...
|
by: Jan |
last post by:
Have an SQL create/import script. Running this on SQL would make it
create a table with some values. Can Access2003 somehow use such and
SQL script?
I went into SQL query view to try it out, but...
|
by: Greg McLennan |
last post by:
I am writing some Visual basic code that needs to create a M$ Access DB
with a table that has a DATE ROW with dd/mm/yyyy in the Format as you
would see in the general tab of the table-view.
e.g...
|
by: GCM |
last post by:
Hi,
I have a table that has the following fields; LName, FName and MName. Also
there are other fields in the table. I need to create another table with
those fields combined as "Trim( & " " & &...
|
by: Priya |
last post by:
Hey all,
Is there a way to create a table in the SQL database by using an XML
file as an input? I want to have an XML file which holds all the
details of the table like the tablename, columns,...
|
by: genti1 |
last post by:
Hi,
I am kind of new with Access and I was wandering if someone could help me create a form where I can query data in a table by entering values in that form.
For Example:
I have a table...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |