this time i am going to use the scripts from the book and just change
the names to match what i am trying to do now i just got an error that
i know shouldnt be an error i think. this is the error:
Could add the site entry because: Column count doesn't match value
count at row 1. The query was INSERT INTO home (home_id, header, body,
date_entered) VALUES ('Welcome!', 'What is a Progressive Parent? A
Progressive Parent ...
now i created the table using what the book gave me which is:
// Define the query.
$query = 'CREATE TABLE home (
home_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
header VARCHAR(100) NOT NULL,
body TEXT NOT NULL,
date_entered DATETIME NOT NULL
)';
// Run the query.
if (@mysql_query ($query)) {
print '<p>The table has been created.</p>';
} else {
die ('<p>Could not create the table because: <b>' . mysql_error() .
'</b>.</p><p>The query being run was: ' . $query . '</p>');
}
and when i ran that script live i got the message "The table has been
created."
now when i run this script and try to insert the data is when i get the
error message i posted above and that script looks like:
// Define the query.
$query = "INSERT INTO home (home_id, header, body, date_entered)
VALUES ('{$_POST['header']}', '{$_POST['body']}', NOW())";
// Execute the query.
if (@mysql_query ($query)) {
print '<p>The site entry has been added.</p>';
} else {
print "<p>Could add the site entry because: <b>" . mysql_error() .
"</b>. The query was $query.</p>";
}
mysql_close();
}
// Display the form.
?>
<form action="edit_si te.php" method="post">
<p>Entry Title: <input type="text" name="header" size="40"
maxsize="100" /></p>
<p>Entry Text: <textarea name="body" cols="40" rows="5"></textarea></p>
<input type="submit" name="submit" value="Add to the Site" />
</form> 8 1634
to me it looks like the dateentered and the home id arent being entered
into the database correct?
so many sites so little time wrote:
this time i am going to use the scripts from the book and just change
the names to match what i am trying to do now i just got an error that
i know shouldnt be an error i think. this is the error:
Could add the site entry because: Column count doesn't match value
count at row 1. The query was INSERT INTO home (home_id, header, body,
date_entered) VALUES ('Welcome!', 'What is a Progressive Parent? A
Progressive Parent ...
now i created the table using what the book gave me which is:
// Define the query.
$query = 'CREATE TABLE home (
home_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
header VARCHAR(100) NOT NULL,
body TEXT NOT NULL,
date_entered DATETIME NOT NULL
)';
// Run the query.
if (@mysql_query ($query)) {
print '<p>The table has been created.</p>';
} else {
die ('<p>Could not create the table because: <b>' . mysql_error() .
'</b>.</p><p>The query being run was: ' . $query . '</p>');
}
and when i ran that script live i got the message "The table has been
created."
now when i run this script and try to insert the data is when i get the
error message i posted above and that script looks like:
// Define the query.
$query = "INSERT INTO home (home_id, header, body, date_entered)
VALUES ('{$_POST['header']}', '{$_POST['body']}', NOW())";
// Execute the query.
if (@mysql_query ($query)) {
print '<p>The site entry has been added.</p>';
} else {
print "<p>Could add the site entry because: <b>" . mysql_error() .
"</b>. The query was $query.</p>";
}
mysql_close();
}
// Display the form.
?>
<form action="edit_si te.php" method="post">
<p>Entry Title: <input type="text" name="header" size="40"
maxsize="100" /></p>
<p>Entry Text: <textarea name="body" cols="40" rows="5"></textarea></p>
<input type="submit" name="submit" value="Add to the Site" />
</form>
this is the print out from phpmyadmin if you have used that before this
might help you understand the structure of the table
home:
Field Type Null Default
home_id int(10) No
header varchar(100) No
body text No
date_entered datetime No 0000-00-00 00:00:00
Indexes:
Keyname Type Cardinality Field
PRIMARY PRIMARY 0 home_id
Space usage:
Type Usage
Data 0 B
Index 1,024 B
Total 1,024 B
Row Statistics:
Statements Value
Format dynamic
Rows 0
Next Autoindex 1
Creation Nov 19, 2006 at 10:43 AM
Last update Nov 19, 2006 at 10:43 AM
so many sites so little time wrote:
to me it looks like the dateentered and the home id arent being entered
into the database correct?
so many sites so little time wrote:
this time i am going to use the scripts from the book and just change
the names to match what i am trying to do now i just got an error that
i know shouldnt be an error i think. this is the error:
Could add the site entry because: Column count doesn't match value
count at row 1. The query was INSERT INTO home (home_id, header, body,
date_entered) VALUES ('Welcome!', 'What is a Progressive Parent? A
Progressive Parent ...
now i created the table using what the book gave me which is:
// Define the query.
$query = 'CREATE TABLE home (
home_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
header VARCHAR(100) NOT NULL,
body TEXT NOT NULL,
date_entered DATETIME NOT NULL
)';
// Run the query.
if (@mysql_query ($query)) {
print '<p>The table has been created.</p>';
} else {
die ('<p>Could not create the table because: <b>' . mysql_error() .
'</b>.</p><p>The query being run was: ' . $query . '</p>');
}
and when i ran that script live i got the message "The table has been
created."
now when i run this script and try to insert the data is when i get the
error message i posted above and that script looks like:
// Define the query.
$query = "INSERT INTO home (home_id, header, body, date_entered)
VALUES ('{$_POST['header']}', '{$_POST['body']}', NOW())";
// Execute the query.
if (@mysql_query ($query)) {
print '<p>The site entry has been added.</p>';
} else {
print "<p>Could add the site entry because: <b>" . mysql_error() .
"</b>. The query was $query.</p>";
}
mysql_close();
}
// Display the form.
?>
<form action="edit_si te.php" method="post">
<p>Entry Title: <input type="text" name="header" size="40"
maxsize="100" /></p>
<p>Entry Text: <textarea name="body" cols="40" rows="5"></textarea></p>
<input type="submit" name="submit" value="Add to the Site" />
</form>
"so many sites so little time" <kk*****@gmail. comwrote in message
news:11******** **************@ m73g2000cwd.goo glegroups.com.. .
this time i am going to use the scripts from the book and just change
the names to match what i am trying to do now i just got an error that
i know shouldnt be an error i think. this is the error:
Could add the site entry because: Column count doesn't match value
count at row 1. The query was INSERT INTO home (home_id, header, body,
date_entered) VALUES ('Welcome!', 'What is a Progressive Parent? A
Progressive Parent ...
now i created the table using what the book gave me which is:
// Define the query.
$query = 'CREATE TABLE home (
home_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
header VARCHAR(100) NOT NULL,
body TEXT NOT NULL,
date_entered DATETIME NOT NULL
)';
// Run the query.
if (@mysql_query ($query)) {
print '<p>The table has been created.</p>';
} else {
die ('<p>Could not create the table because: <b>' . mysql_error() .
'</b>.</p><p>The query being run was: ' . $query . '</p>');
}
and when i ran that script live i got the message "The table has been
created."
now when i run this script and try to insert the data is when i get the
error message i posted above and that script looks like:
// Define the query.
$query = "INSERT INTO home (home_id, header, body, date_entered)
VALUES ('{$_POST['header']}', '{$_POST['body']}', NOW())";
// Execute the query.
if (@mysql_query ($query)) {
print '<p>The site entry has been added.</p>';
} else {
print "<p>Could add the site entry because: <b>" . mysql_error() .
"</b>. The query was $query.</p>";
}
mysql_close();
}
First problem is you are not entering your home_id at all (it takes a 0 -
zero or a NULL to work), make your $query look like this:
$query = "INSERT INTO home (home_id, header, body, date_entered) VALUES
(NULL,'{$_POST['header']}', '{$_POST['body']}', NOW())";
....and second (and personal taste) is if you aren't using multi-dimensional
arrays you can do it this way:
$query = "INSERT INTO home (home_id, header, body, date_entered) VALUES
(NULL,'$_POST[header]', '$_POST[body]', NOW())";
// Display the form.
?>
<form action="edit_si te.php" method="post">
<p>Entry Title: <input type="text" name="header" size="40"
maxsize="100" /></p>
<p>Entry Text: <textarea name="body" cols="40" rows="5"></textarea></p>
<input type="submit" name="submit" value="Add to the Site" />
</form>
Norm
--
FREE Avatar hosting at www.easyavatar.com
Norman Peelman wrote:
"so many sites so little time" <kk*****@gmail. comwrote in message
news:11******** **************@ m73g2000cwd.goo glegroups.com.. .
>>this time i am going to use the scripts from the book and just change the names to match what i am trying to do now i just got an error that i know shouldnt be an error i think. this is the error:
Could add the site entry because: Column count doesn't match value count at row 1. The query was INSERT INTO home (home_id, header, body, date_entere d) VALUES ('Welcome!', 'What is a Progressive Parent? A Progressive Parent ...
now i created the table using what the book gave me which is:
// Define the query. $query = 'CREATE TABLE home ( home_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, header VARCHAR(100) NOT NULL, body TEXT NOT NULL, date_entere d DATETIME NOT NULL )';
// Run the query. if (@mysql_query ($query)) { print '<p>The table has been created.</p>'; } else { die ('<p>Could not create the table because: <b>' . mysql_error() . '</b>.</p><p>The query being run was: ' . $query . '</p>'); }
and when i ran that script live i got the message "The table has been created."
now when i run this script and try to insert the data is when i get the error message i posted above and that script looks like:
// Define the query. $query = "INSERT INTO home (home_id, header, body, date_entered) VALUES ('{$_POST['header']}', '{$_POST['body']}', NOW())";
// Execute the query. if (@mysql_query ($query)) { print '<p>The site entry has been added.</p>'; } else { print "<p>Could add the site entry because: <b>" . mysql_error() . "</b>. The query was $query.</p>"; }
mysql_close() ;
}
First problem is you are not entering your home_id at all (it takes a 0 -
zero or a NULL to work), make your $query look like this:
Incorrect. It is perfectly valid to not enter home_id in the INSERT
statement. The autonum value will be used.
$query = "INSERT INTO home (home_id, header, body, date_entered) VALUES
(NULL,'{$_POST['header']}', '{$_POST['body']}', NOW())";
This will also work, but is not necessary.
...and second (and personal taste) is if you aren't using multi-dimensional
arrays you can do it this way:
$query = "INSERT INTO home (home_id, header, body, date_entered) VALUES
(NULL,'$_POST[header]', '$_POST[body]', NOW())";
Additionally, you should never use data entered by the user without
validating it. Additionally, any data entered should be processed by
mysql_real_esca pe_string() before placing in the database.
>
>>// Display the form. ?> <form action="edit_si te.php" method="post"> <p>Entry Title: <input type="text" name="header" size="40" maxsize="10 0" /></p> <p>Entry Text: <textarea name="body" cols="40" rows="5"></textarea></p> <input type="submit" name="submit" value="Add to the Site" /> </form>
Norm
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attgl obal.net
=============== ===
Jerry Stuckle wrote:
Norman Peelman wrote:
>"so many sites so little time" <kk*****@gmail. comwrote in message news:11******* *************** @m73g2000cwd.go oglegroups.com. ..
>>>// Define the query. $query = "INSERT INTO home (home_id, header, body, date_entered)
^==1==^ ^==2=^ ^=3^ ^=====4====^
>>>VALUES ('{$_POST['header']}', '{$_POST['body']}', NOW())";
^=========1==== ====^ ^========2===== ==^ ^=3=^
ERROR 1136 (21S01): Column count doesn't match value count ...
4 columns (home_id, header, body, and date_entered) and 3 values give
the error 1136 in my MySQL (v 4.1.10)
>First problem is you are not entering your home_id at all (it takes a 0 - zero or a NULL to work), make your $query look like this:
Incorrect. It is perfectly valid to not enter home_id in the INSERT
statement. The autonum value will be used.
I agree with Norm :)
The SQL statement from "so many sites so little time" generates an
error.
The only way to make it valid is to eliminate it from the column
specification:
$query = "INSERT INTO home (header, body, date_entered)
VALUES ('{$_POST['header']}', '{$_POST['body']}', NOW())";
--
I (almost) never check the dodgeit address.
If you *really* need to mail me, use the address in the Reply-To
header with a message in *plain* *text* *without* *attachments*.
thanks so much for all the help im going to remove the home_id if that
doesnt work i am going to make it null all i am really trying to achive
in the end is a page where a client could enter that they would like
text on their site to be and update the database with that text and a
script that would display that text. i went out tonight and bought
another php book its the php phrasebook by chris wenz. i have quite a
few books on php and or mysql 4 to be exact and none of them really got
what i needed for this through to my head but tonight a sat at borders
with a cup of coffee and read through the section on inserting and
displaying data from a mysql database from the sections of every single
php, and php and mysql book that they had in stock and took notes so i
should be golden if there are anymore problems or errors with this i
will let you guys know so you can be of help and that you all for
helping so much you are all really good people for taking the time to
help me out. : )
Pedro Graca wrote:
Jerry Stuckle wrote:
Norman Peelman wrote:
"so many sites so little time" <kk*****@gmail. comwrote in message
news:11******** **************@ m73g2000cwd.goo glegroups.com.. . // Define the query. $query = "INSERT INTO home (home_id, header, body, date_entered)
^==1==^ ^==2=^ ^=3^ ^=====4====^
>>VALUES ('{$_POST['header']}', '{$_POST['body']}', NOW())";
^=========1==== ====^ ^========2===== ==^ ^=3=^
ERROR 1136 (21S01): Column count doesn't match value count ...
4 columns (home_id, header, body, and date_entered) and 3 values give
the error 1136 in my MySQL (v 4.1.10)
First problem is you are not entering your home_id at all (it takes a 0 -
zero or a NULL to work), make your $query look like this:
Incorrect. It is perfectly valid to not enter home_id in the INSERT
statement. The autonum value will be used.
I agree with Norm :)
The SQL statement from "so many sites so little time" generates an
error.
The only way to make it valid is to eliminate it from the column
specification:
$query = "INSERT INTO home (header, body, date_entered)
VALUES ('{$_POST['header']}', '{$_POST['body']}', NOW())";
--
I (almost) never check the dodgeit address.
If you *really* need to mail me, use the address in the Reply-To
header with a message in *plain* *text* *without* *attachments*.
so many sites so little time wrote:
thanks so much for all the help im going to remove the home_id if that
doesnt work i am going to make it null all i am really trying to achive
in the end is a page where a client could enter that they would like
text on their site to be and update the database with that text and a
script that would display that text. i went out tonight and bought
another php book its the php phrasebook by chris wenz. i have quite a
few books on php and or mysql 4 to be exact and none of them really got
what i needed for this through to my head but tonight a sat at borders
with a cup of coffee and read through the section on inserting and
displaying data from a mysql database from the sections of every single
php, and php and mysql book that they had in stock and took notes so i
should be golden if there are anymore problems or errors with this i
will let you guys know so you can be of help and that you all for
helping so much you are all really good people for taking the time to
help me out. : )
Pedro Graca wrote:
>>Jerry Stuckle wrote:
>>>Norman Peelman wrote:
"so many sites so little time" <kk*****@gmail. comwrote in message news:11**** *************** ***@m73g2000cwd .googlegroups.c om...
>// Define the query. >$query = "INSERT INTO home (home_id, header, body, date_entered)
^==1==^ ^==2=^ ^=3^ ^=====4====^
>>>>>VALUES ('{$_POST['header']}', '{$_POST['body']}', NOW())";
^=========1==== ====^ ^========2===== ==^ ^=3=^
ERROR 1136 (21S01): Column count doesn't match value count ...
4 columns (home_id, header, body, and date_entered) and 3 values give the error 1136 in my MySQL (v 4.1.10)
>>>>First problem is you are not entering your home_id at all (it takes a 0 - zero or a NULL to work), make your $query look like this:
Incorrect. It is perfectly valid to not enter home_id in the INSERT statement. The autonum value will be used.
I agree with Norm :) The SQL statement from "so many sites so little time" generates an error.
The only way to make it valid is to eliminate it from the column specification :
$query = "INSERT INTO home (header, body, date_entered) VALUES ('{$_POST['header']}', '{$_POST['body']}', NOW())"; -- I (almost) never check the dodgeit address. If you *really* need to mail me, use the address in the Reply-To header with a message in *plain* *text* *without* *attachments*.
While you're at it, please buy a book on how to post to usenet. You're
making things much harder on yourself in the way you're posting.
If you were posting properly you would get a lot more responses to your
messages.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attgl obal.net
=============== ===
so many sites so little time wrote:
<snip>
You took ME?
Woot, I completely missed that. :P
Erwin Moller This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Erwin Kloibhofer |
last post by:
what if i have a webpage that displays the text "please wait, this may take
a few seconds..." and it now waits until some event on the server happens.
whatever this is, this can be quick, but it could also be slow, or it can
even fail. but once this event has happened, i want the webpage to reload
and display a different message, like "the process completed successfully".
my question now is, how would i achieve this without constant...
|
by: Steven Matthew Bennett |
last post by:
I don't know about the rest of the posters, but I came to this NG to learn
more about Access, not to have some idiot homophobic dipshit spewing hate
with every post. You have nothing to add to this group that is remotely
on-topic, so unless you're gonna learn Access do us a favor and get lost.
Do you know how many Access MVP's post here? Do you know how much of their
valuable time is spent helping people?
I've had a number of MVP's...
|
by: Serdar Kalaycý |
last post by:
Hi everybody,
My problem seems a bit clichè but I could not work around.
Well I read lots of MSDN papers and discussions, but my problem is a bit
different from them. When I tried to run the project in debug mode (by
hitting F5) it gives an error message
"Error while trying to run project: Unable to start debugging on the web
server.
|
by: Kirk |
last post by:
The following C# web service works fine until you uncomment the lines
setting UserName and Password. Then the process starts as the
specified user, but hangs in a suspended state. In fact, any
executable will exhibit this problem; it is not specific to whoami.exe.
This is with .NET 2.0, of course (1.1 does not support running a
process as a different user). This appears to be a bug. Can anyone
comment?
<%@ WebService Language="C#"...
|
by: Bob Nelson |
last post by:
It's been a long time since I've posed a query here on c.l.c. My work
environment evolved to primarily C++ and Perl with very little C, so I've
forgotten quite a lot over time.
This revisits the much-discussed topic of decrementing a pointer to the
non-existent location before the start of an array. I've been re-reading
K.N. King's ``C Programming: A Modern Approach'' and came across
``reverse2.c'' on page 228, which raised a red flag. I...
| |
by: Gotisch |
last post by:
Hi,
we are currently writing an mostly singlethreaded (game)server
application in c#. But we are encountering problems with the Garbage
Collector: After a certain time but also apparently randomly the GC
starts working Alot and taking up to 60-70% of the cpu time, which
results in huge lags in responce time of the server.
The server uses (depending on the setting) around 350-800 MB of memory
( the servers we tested this on had from...
|
by: HR Head |
last post by:
Dear All,
Fresh Programmers Required Urgently Visual Foxpro / VB / .NET
Skill set required :- Visual Foxpro 1 or 2 years Experince
Location:- Malaysia / Singapore
Qulification ;- Any Graduate / Under Graduate
|
by: crazychrisy54 |
last post by:
Hi there
I currently have a Python program outputing to the command line,
durations of 'completed Steps' and 'data items' in relation to time
i.e.
--------------jfh
---------kl //kl started after jfh finished
% Ds //new data arrived at this point in time
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
| |
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: 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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |