INSERT no posible in MySQL
| From: | César L . Aracena | Date: | Sun, 26 May 2002 19:59:29 +0000 |
| Subject: | INSERT no posible in MySQL | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-19445@lists.php.net to get a copy of this message | ||
Hi all,
I have a 3-page form input, where the variables are passed from one page to another using
HTTP_POST_VARS and stored in the next one in HIDDEN fields (just to make sure). At the end of the
3rd page, is another one where I thank the visitor and proccess all the data.
The data proccess consist in two steps. First, I save the data into a MySQL DB table (just for
record keeping) with an auto_increment id number and Second, the script sends an e-mail to me in
order to view the visitor's request.
I haven't got into the email part yet (which it's going to be new to me) because I have
this HUGE error when tring to store the data into the DB. What I written is the following (obviusly
the db_connect() is well done but not written here):
$query = "INSERT INTO tablename (name, company, specialty, .........) VALUES
($HTTP_POST_VARS['name'], $HTTP_POST_VARS['company'],
$HTTP_POST_VARS['specialty'], ...........";
$result = mysql_query($query);
if (mysql_errno())
{
die("<BR>" . mysql_errno().": ".mysql_errno()."<BR>");
}
The error that shows is:
Parse error: parse error, expecting
T_STRING' or T_VARIABLE' or
`T_NUM_STRING' in C:\apache\htdocs\icaam2\consultas\pres_sent.php on line 3
Before I used $HTTP_POST_VARS[] I used to get the mysql_errno(): 1046 and 1064 (when using just the
variable names).
Where can the problem be? Also, I would be very greatefull if someone could tell me how to send the
e-mail using sendmail.
Thanx in advance,
Cesar Aracena
caracena@infovia.com.ar
Neuquen, Argentina