473,506 Members | 14,630 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

fill MySQL table with PHP

Hello, I don't seem to get the following right.

In the following I try to fill a MySQL table named 'mutation'. The first
element is a date but MySQL sees this as 0000-00-00 instead of the
date 2002-11-01. Other problem is the textstring in
$_POST['verklaring1'], in MySQL this stays empty.

Can anybody help me with these problems, what am I ding wrong ?
<?php
$query = "insert into mutation values (2002-11-01, 1, 4, 1, 4, 10, 330 ,
' $_POST['verklaring1'] ',\N,\N,\N,\N)";
mysql_db_query("projects", $query);
?>

Thanks, Edward

Jul 19 '05 #1
2 5051
edward hage wrote:
Hello, I don't seem to get the following right.

In the following I try to fill a MySQL table named 'mutation'. The first
element is a date but MySQL sees this as 0000-00-00 instead of the
date 2002-11-01. Other problem is the textstring in
$_POST['verklaring1'], in MySQL this stays empty.

Can anybody help me with these problems, what am I ding wrong ?
<?php
$query = "insert into mutation values (2002-11-01, 1, 4, 1, 4, 10, 330 ,
' $_POST['verklaring1'] ',\N,\N,\N,\N)";
mysql_db_query("projects", $query);
?>


2002-11-01 is supposed to be string, so it should be inside '' characters.

$query = "insert into mutation values ('2002-11-01', 1, 4, 1, 4, 10, 330

Also do:

echo "My query is: " . $query;

To see how your query looks like. You might found out the reason why
verklaring1 stays empty.

Jul 19 '05 #2
edward hage wrote:
Hello, I don't seem to get the following right.

In the following I try to fill a MySQL table named 'mutation'. The first
element is a date but MySQL sees this as 0000-00-00 instead of the
date 2002-11-01. Other problem is the textstring in
$_POST['verklaring1'], in MySQL this stays empty.

Can anybody help me with these problems, what am I ding wrong ?
<?php
$query = "insert into mutation values (2002-11-01, 1, 4, 1, 4, 10, 330 ,
' $_POST['verklaring1'] ',\N,\N,\N,\N)";
mysql_db_query("projects", $query);
?>


2002-11-01 is supposed to be string, so it should be inside '' characters.

$query = "insert into mutation values ('2002-11-01', 1, 4, 1, 4, 10, 330

Also do:

echo "My query is: " . $query;

To see how your query looks like. You might found out the reason why
verklaring1 stays empty.

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
8535
by: Richard Galli | last post by:
I want viewers to compare state laws on a single subject. Imagine a three-column table with a drop-down box on the top. A viewer selects a state from the list, and that state's text fills the...
0
6441
by: Gordon | last post by:
I have 2 tables t and t1. In this case, t1 is a copy of t. I want to delete rows from t1 based on criteria on the t table and a relationship between t ad t1 (in this case the id column). In the...
0
3510
by: Lenz Grimmer | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, MySQL 4.0.14, a new version of the popular Open Source/Free Software Database, has been released. It is now available in source and binary...
6
3544
by: jacob nikom | last post by:
I would like to create data model for a group of stores. All stores in this group are very similar to each other, so it is natural to allocate one MySQL database per store. Each database is going...
0
1303
by: edward hage | last post by:
Hello, I don't seem to get the following right. In the following I try to fill a MySQL table named 'mutation'. The first element is a date but MySQL sees this as 0000-00-00 instead of the date...
39
8367
by: Mairhtin O'Feannag | last post by:
Hello, I have a client (customer) who asked the question : "Why would I buy and use UDB, when MySql is free?" I had to say I was stunned. I have no experience with MySql, so I was left sort...
6
7317
by: Radovan Radic | last post by:
Hello I tried to find answer on google but i didnt find it. Using MySQL 4, with MyODBC driver This code: string sql = "SELECT * FROM Poruke"; OdbcDataAdapter da = new OdbcDataAdapter();...
1
3358
by: jlee | last post by:
I'm pretty much a newbie on mysql, and I need some help. I am running mysql Ver 12.22 Distrib 4.0.24, for portbld-freebsd5.4 (i386) on a server hosting an active website. The site's developer...
1
2817
by: Good Man | last post by:
Hi there I've noticed some very weird things happening with my current MySQL setup on my XP Laptop, a development machine. For a while, I have been trying to get the MySQL cache to work....
6
38453
Atli
by: Atli | last post by:
This is an easy to digest 12 step guide on basics of using MySQL. It's a great refresher for those who need it and it work's great for first time MySQL users. Anyone should be able to get...
0
7220
marktang
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,...
0
7308
Oralloy
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,...
0
7371
jinu1996
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...
0
7479
tracyyun
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...
0
5617
agi2029
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,...
1
5037
isladogs
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...
0
4702
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...
0
3178
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
410
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.