Re: INSERT no posible in MySQL

From: Date: Mon, 27 May 2002 02:03:32 +0000
Subject: Re: INSERT no posible in MySQL
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-19450@lists.php.net to get a copy of this message
Thanx... it worked using double quotes around the variable name ({$HTTP_POST_VARS["varname"]} ----- Original Message ----- From: "Marcelo Leitner" <mrl@netbank.com.br> To: "César L. Aracena @hellfire.leitner.homeip.net" <caracena@infovia.com.ar@hellfire.leitner.homeip.net,> Cc: "PHP DB List" <php-db@lists.php.net> Sent: Sunday, May 26, 2002 5:18 PM Subject: Re: [PHP-DB] INSERT no posible in MySQL > On Sun, May 26, 2002 at 04:59:29PM -0300, =?iso-8859-1?Q?C=E9sar_L. _Aracena?= wrote: > > 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 > ---end quoted text--- > If you want to php parses "$HTTP_POST_VARS[...]", you must do "{$HTTP_POST_VARS[...]}".. > or "...".$HTTP_POST_VARS[...]."..."; > > []'s > -- > Marcelo R Leitner <mrl@netbank.com.br> >

« previous php.db (#19450) next »