this code is producing the message BUT it is entering the data. What should i do? -
<?php
-
if (!$_POST) {
-
//haven't seen the form, so show it
-
$display_block = "
-
<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">
-
<p><strong>First/Last Names:</strong><br/>
-
<input type=\"text\" name=\"f_name\" size=\"30\" maxlength=\"75\">
-
<input type=\"text\" name=\"l_name\" size=\"30\" maxlength=\"75\"></p>
-
-
<p><strong>Address:</strong><br/>
-
<input type=\"text\" name=\"address\" size=\"30\"></p>
-
-
<p><strong>City/State/Zip:</strong><br/>
-
<input type=\"text\" name=\"city\" size=\"30\" maxlength=\"50\">
-
<input type=\"text\" name=\"state\" size=\"5\" maxlength=\"2\">
-
<input type=\"text\" name=\"zipcode\" size=\"10\" maxlength=\"10\"></p>
-
-
<p><strong>Address Type:</strong><br/>
-
<input type=\"radio\" name=\"add_type\" value=\"home\" checked> home
-
<input type=\"radio\" name=\"add_type\" value=\"work\"> work
-
<input type=\"radio\" name=\"add_type\" value=\"other\"> other</p>
-
-
<p><strong>Telephone Number:</strong><br/>
-
<input type=\"text\" name=\"tel_number\" size=\"30\" maxlength=\"25\">
-
<input type=\"radio\" name=\"tel_type\" value=\"home\" checked> home
-
<input type=\"radio\" name=\"tel_type\" value=\"work\"> work
-
<input type=\"radio\" name=\"tel_type\" value=\"other\"> other</p>
-
-
<p><strong>Fax Number:</strong><br/>
-
<input type=\"text\" name=\"fax_number\" size=\"30\" maxlength=\"25\">
-
<input type=\"radio\" name=\"fax_type\" value=\"home\" checked> home
-
<input type=\"radio\" name=\"fax_type\" value=\"work\"> work
-
<input type=\"radio\" name=\"fax_type\" value=\"other\"> other</p>
-
-
<p><strong>Email Address:</strong><br/>
-
<input type=\"text\" name=\"email\" size=\"30\" maxlength=\"150\">
-
<input type=\"radio\" name=\"email_type\" value=\"home\" checked> home
-
<input type=\"radio\" name=\"email_type\" value=\"work\"> work
-
<input type=\"radio\" name=\"email_type\" value=\"other\"> other</p>
-
-
<p><strong>Personal Note:</strong><br/>
-
<textarea name=\"note\" cols=\"35\" rows=\"3\" wrap=\"virtual\"></textarea></p>
-
-
<p><input type=\"submit\" name=\"submit\" value=\"Add Entry\"></p>
-
</form>";
-
-
} else if ($_POST) {
-
//time to add to tables, so check for required fields
-
if (($_POST["f_name"] == "") || ($_POST["l_name"] == "")) {
-
header("Location: addentry.php");
-
exit;
-
}
-
-
//connect to database
-
$mysqli = mysqli_connect("localhost", "web86-geothermal", "pw002f1945", "web86-geothermal");
-
-
//add to master_name table
-
$add_master_sql = "INSERT INTO tbl_master_name (master_id, date_added, date_modified, f_name, l_name)
-
VALUES ('', now(), now(), '".$_POST["f_name"]."', '".$_POST["l_name"]."')";
-
$add_master_res = mysqli_query($mysqli, $add_master_sql) or die(mysqli_error($mysqli));
-
-
//get master_id for use with other tables
-
$master_id = mysqli_insert_id($mysqli);
-
-
if (($_POST["address"]) || ($_POST["city"]) || ($_POST["state"]) || ($_POST["zipcode"])) {
-
//something relevant, so add to address table
-
$add_address_sql = "INSERT INTO tbl_address (master_id, date_added, date_modified,
-
address1, address2, city, state, zipcode, type) VALUES ('".$master_id."',
-
now(), now(), '".$_POST["address"]."', '".$_POST["city"]."',
-
'".$_POST["state"]."' , '".$_POST["zipcode"]."' , '".$_POST["add_type"]."')";
-
$add_address_res = mysqli_query($mysqli, $add_address_sql) or die(mysqli_error($mysqli));
-
}
-
-
if ($_POST["tel_number"]) {
-
//something relevant, so add to telephone table
-
$add_tel_sql = "INSERT INTO tbl_telephone (master_id, date_added, date_modified,
-
tel_number, type) VALUES ('".$master_id."', now(), now(),
-
'".$_POST["tel_number"]."', '".$_POST["tel_type"]."')";
-
$add_tel_res = mysqli_query($mysqli, $add_tel_sql) or die(mysqli_error($mysqli));
-
}
-
-
if ($_POST["fax_number"]) {
-
//something relevant, so add to fax table
-
$add_fax_sql = "INSERT INTO tbl_fax (master_id, date_added, date_modified,
-
fax_number, type) VALUES ('".$master_id."', now(), now(),
-
'".$_POST["fax_number"]."', '".$_POST["fax_type"]."')";
-
$add_fax_res = mysqli_query($mysqli, $add_fax_sql) or die(mysqli_error($mysqli));
-
}
-
-
if ($_POST["email"]) {
-
//something relevant, so add to email table
-
$add_email_sql = "INSERT INTO tbl_email (master_id, date_added, date_modified,
-
email, type) VALUES ('".$master_id."', now(), now(),
-
'".$_POST["email"]."', '".$_POST["email_type"]."')";
-
$add_email_res = mysqli_query($mysqli, $add_email_sql) or die(mysqli_error($mysqli));
-
}
-
-
if ($_POST["note"]) {
-
//something relevant, so add to notes table
-
$add_notes_sql = "INSERT INTO tbl_personal_notes (master_id, date_added, date_modified,
-
note) VALUES ('".$master_id."', now(), now(), '".$_POST["note"]."')";
-
$add_notes_res = mysqli_query($mysqli, $add_notes_sql) or die(mysqli_error($mysqli));
-
}
-
mysqli_close($mysqli);
-
$display_block = "<p>Your entry has been added. Would you like to <a href=\"addentry.php\">add another</a>?</p>";
-
}
-
?>
-
<html>
-
<head>
-
<title>Add an Entry</title>
-
</head>
-
<body>
-
<h1>Add an Entry</h1>
-
<?php echo $display_block; ?>
-
</body>
-
</html>
3 5540
Hi,
when your inserting address it looks like you missed out a value...
remember the insert syntax is.... - insert into tblName (column1, column2) values ("column1","column2")
you've got something like this... - insert into tblName (column1, column2) values ("column1")
Where you've missed one of the columns.
let me know how you get on.
aha, found it.
So the message actually means that your mysql column count doesnt match the number of values it has to insert into db
yea, it could be insert, or update, i think even select if you make up the name for a column ;)
glad you solved it :)
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Aaron C |
last post by:
Hi,
I'm trying to do an insert with the following statement:
INSERT INTO user VALUES ( 'ag@ag.com','ag','Aaron','Chandler','','','La
Mirada','CA',90638,714,'','');
and I'm getting the error message "Column count doesn't match value
count at row 1".
|
by: M.Kamermans |
last post by:
I have an XSLT script that has to operate on some particularly nasty XML to
turn it into a SQL databse, but 'entries' in the XML aren't actually
unique, so their unique identifier is useless. I need to somehow create
crosslinked tables using the XSLT, but can only do this by maintaining a
counter for each line I write.
Is there a way to create a proxy 'increment' function that lets me maintain
a counter variable?
- Mike Kamermans
|
by: Dmitry V. Markin |
last post by:
Good day!
Here is my problem: I need to have a radiobutton column in my DataGrid for a
representation of a bool column, where only row can be checked at one
time(only one value in bool column can be true). So I've created a class
inheriting from DataGridColumnStyle and added the following code to the class:
protected RadioButton rb ;
....
|
by: Alpha |
last post by:
I retrieve a table with only 2 columns. One is a auto-generated primary key
column and the 2nd is a string. When I add a new row to the dataset to be
updated back to the database. What should I do with the 1st column ? (Below
I have a "1" in place for now). Also, Does the datase.AcceptChanges();
updates the changes to the database? Which command do I use to update the
changes in dataset back to the Access database table? Thanks, Alpha...
|
by: tania |
last post by:
i have this table in my database:
CREATE TABLE FILM(
F_ID INT(5) NOT NULL AUTO_INCREMENT,
F_TITLE VARCHAR(40) NOT NULL,
DIRECTOR_FNAME VARCHAR(20) NOT NULL,
DIRECTOR_LNAME VARCHAR(20) NOT NULL,
TYPE VARCHAR(30) NOT NULL,
DURATION TIME ,
YEAR_RELEASE YEAR NOT NULL,
DESCRIPTION TEXT,
| |
by: Gary Wessle |
last post by:
Hi
I have a vector<charwhich looks like this (a d d d a d s g e d d d d
d k)
I need to get the biggest count of consecutive 'd'. 5 in this example
I am toying with this method but not sure if it is optimal.
thanks
int k = 0;
|
by: John |
last post by:
I just cannot manage to perform a SELECT query with NULL parameter...
My CATEGORY table does have one row where TCATEGORYPARENTID is null (real DB
null value).
TCATEGORYID and TCATEGORYPARENTID are uniqueidentifier columns.
My questions:
- is Type="Object", below, necessary?
- what shall I specify for DefaultValue in my function? I tried everything.
|
by: Jay |
last post by:
I need to convert from a string a double that is followed by a scaling character (k means *1e3,
M=*1e6, etc) then apply the scaling character. Example:
"-1.345k #comment"
I know roughly how to do this in C (using the %n in the sscanf format specifier to find the number
of characters converted) , but how do I do it in C#? My problem is how to count the number of
characters of the double (chpos in the C example) so that the scaling...
|
by: Joe Meng |
last post by:
Greetings,
I've seen this question asked and answered here, just not completely yet.
I'm wondering how to use a column value as a table name in another query. So far it's looking like you must use dynamic SQL, external to DB2.
An example: TableX contains column TabName, which is populated by the names of tables in the database. Each of these named tables contains a field called "VID". I wish to match some value of VID in each of...
|
by: Byomokesh |
last post by:
Hi
I am trying to cell count and match in tgroup cols value in XML file. if cell count and tgrou cols value is mismatch, its showing error.
My xml
--------------
<tgroup cols="3">
<colspec colnum="1" colname="col1"/>
<colspec colnum="2" colname="col2"/>
<colspec colnum="3" colname="col3"/>
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |