Re: Sessions.. (I'm learning), can't call a variable?

From: Date: Thu, 16 Oct 2003 17:41:25 +0000
Subject: Re: Sessions.. (I'm learning), can't call a variable?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-166327@lists.php.net to get a copy of this message
----- Original Message ----- From: <Tristan.Pretty@risk.sungard.com> To: <php-general@lists.php.net> Sent: Thursday, October 16, 2003 8:36 AM Subject: [PHP] Sessions.. (I'm learning), can't call a variable? > Not sure if this is a MySQL Q. or a PHP one, but here goes... > > I'm just learning sessions... > And I'm trying to add a session variable to a MySQL database. > I've done this page that takes the results from a previous form... > But I get this error: > Parse error: parse error, expecting T_STRING' or > T_VARIABLE' or > `T_NUM_STRING' > On line 83 > Which is the line that relates to the line: > \"$_SESSION['salutation'];\", > > I've tried removing the ';' but it change nothing...? > Can anyone see my error? > > ================= > <? > session_start(); > header("Cache-control: private"); > > $_SESSION['salutation'] = $_POST['salutation']; > > //MySQL connection stuff > mysql_query("INSERT INTO $table ( > salutation, > name, > city > } VALUES { > \"$_SESSION['salutation'];\", > \"$_SESSION['name'];\", > \"$_SESSION['city'];\" > } > > ?> > //Rest of page... thanks etc... > ================= > > ********************************************************************* > The information contained in this e-mail message is intended only for > the personal and confidential use of the recipient(s) named above. > If the reader of this message is not the intended recipient or an agent > responsible for delivering it to the intended recipient, you are hereby > notified that you have received this document in error and that any > review, dissemination, distribution, or copying of this message is > strictly prohibited. If you have received this communication in error, > please notify us immediately by e-mail, and delete the original message. > *********************************************************************** > > Try this: VALUES ('".addslashes("$yourvar1")."','".addslashes("$yourvar2")."','".addslashes(" $yourvar3")."')"); Jake

« previous php.general (#166327) next »