[PHP-DB] Re: insert data in mysql table

2004-04-11 Thread Andy Ladouceur
From what I can see, the order that you created the table with and the 
order of the fields in the query do not match up. Changing the query to:

$add_all = INSERT INTO $table 
values('','$name','$day','$question','$email','');

Should make things run just fine.

Cheers,
Andy
Charalambos Nicolaou wrote:

Hi everyone ,

I have created this Mysql table

CREATE TABLE questions (ID INT NOT NULL AUTO_INCREMENT, name 
VARCHAR(25), day DATE, question TEXT, email VARCHAR(30), PRIMARY KEY(ID));

And I am trying to insert data in it using the following

body

?
if(isset($_GET['commented']))
{
echo(Your comment has been posted.);

$host = ;
$user = **;
$pass = *;
$db = **;
$table = questions;
$name = $_GET['form_uname'];
$question = $_GET['form_quest'];
$day = $_GET['form_day'];
$email = $_GET['from_email'];
mysql_connect($host,$user,$pass) or die(mysql_error());
mysql_select_db($db) or die(mysql_error());
$add_all = INSERT INTO $table 
values('$name','$question','$day','$email','');
mysql_query($add_all) or die(mysql_error());
}
else
{
?
form method=get action=? echo $PHP_SELF  ; ? 
Name : input type=text name=form_uname
pQuestion :textarea rows=3 name=form_quest cols=36/textarea/p
pbr
Date: input type=text name=form_day
/p
pEmail: input type=text name=form_emailbrbr
input type= hidden name= commented value= set 
input type=submit value=Submit
/p
/form
?php
}
?
/body
Finally has a result to get the correct data only for the DATE and the 
data from the Question FORM goes to the name field. I do not know where 
the problem is. Help me please because I am going crazy,

Thanks in advance

Charalambos Nicolaou

_
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* 
http://join.msn.com/?page=features/junkmail
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Re:*FIX* insert data in mysql table

2004-04-11 Thread Andy Ladouceur
Oops. I left a field in.
Change it to:
$add_all = INSERT INTO $table
 values('','$name','$day','$question','$email');
Andy

Andy Ladouceur wrote:

 From what I can see, the order that you created the table with and the 
order of the fields in the query do not match up. Changing the query to:

$add_all = INSERT INTO $table 
values('','$name','$day','$question','$email','');

Should make things run just fine.

Cheers,
Andy
Charalambos Nicolaou wrote:

Hi everyone ,

I have created this Mysql table

CREATE TABLE questions (ID INT NOT NULL AUTO_INCREMENT, name 
VARCHAR(25), day DATE, question TEXT, email VARCHAR(30), PRIMARY 
KEY(ID));

And I am trying to insert data in it using the following

body

?
if(isset($_GET['commented']))
{
echo(Your comment has been posted.);

$host = ;
$user = **;
$pass = *;
$db = **;
$table = questions;
$name = $_GET['form_uname'];
$question = $_GET['form_quest'];
$day = $_GET['form_day'];
$email = $_GET['from_email'];
mysql_connect($host,$user,$pass) or die(mysql_error());
mysql_select_db($db) or die(mysql_error());
$add_all = INSERT INTO $table 
values('$name','$question','$day','$email','');
mysql_query($add_all) or die(mysql_error());
}
else
{
?
form method=get action=? echo $PHP_SELF  ; ? 
Name : input type=text name=form_uname
pQuestion :textarea rows=3 name=form_quest 
cols=36/textarea/p
pbr
Date: input type=text name=form_day
/p
pEmail: input type=text name=form_emailbrbr
input type= hidden name= commented value= set 
input type=submit value=Submit
/p
/form
?php
}
?
/body
Finally has a result to get the correct data only for the DATE and the 
data from the Question FORM goes to the name field. I do not know 
where the problem is. Help me please because I am going crazy,

Thanks in advance

Charalambos Nicolaou

_
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* 
http://join.msn.com/?page=features/junkmail
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php