Re: [PHP-DB] Sessions and MySQL?
Cheers to everyone... the curly brackets was me not thinking after a boozy lunch, and trying to recreate code, on an E-mail.. anyhoo... I thought the best idea, and the simplest for me, was to remove the ' from the session recall Turning $_SESSION['salutation'] --> INTO --> $_SESSION[salutation] Cheers all... it's clear as day now... aint it always the way eh? Tris... George Patterson <[EMAIL PROTECTED]> wrote on 16/10/2003 14:15:54: > On Thu, 16 Oct 2003 13:33:28 +0100 > [EMAIL PROTECTED] wrote: > > > 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? > > > > Tristan, > > yes, You are alternating between curly braces {} and parenethes () > (spelling??). Also you forgot to the closing double quotes when > completeing the mysql_query statement. > > You could also put the insert statement into a vairable and echo that to > the screen. That way if you can't see the error, paste the query text > into the mysql command line client. > > See my alterations to you code below.. > > Regards > > > George Patterson > > > = > > > 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... > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > * 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. ***
Re: [PHP-DB] Sessions and MySQL?
On Thu, 16 Oct 2003 13:33:28 +0100 [EMAIL PROTECTED] wrote: > 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? > Tristan, yes, You are alternating between curly braces {} and parenethes () (spelling??). Also you forgot to the closing double quotes when completeing the mysql_query statement. You could also put the insert statement into a vairable and echo that to the screen. That way if you can't see the error, paste the query text into the mysql command line client. See my alterations to you code below.. Regards George Patterson > = > 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... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Sessions and MySQL?
Eeek, didn't notice your brackets. They're a bit messed up as well. mysql_query("INSERT INTO $table (salutation, name, city) VALUES (\"".$_SESSION['salutation']."\", \"".$_SESSION['name']."\", \"".$_SESSION['city']."\");"); This MIGHT work :-) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 16 October 2003 13:33 To: [EMAIL PROTECTED] Subject: [PHP-DB] Sessions and MySQL? 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? = //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. *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Sessions and MySQL?
Try this instead: mysql_query("INSERT INTO $table ( salutation, name, city } VALUES { \"".$_SESSION['salutation']."\", \"".$_SESSION['name']."\", \"".$_SESSION['city']."\" } -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 16 October 2003 13:33 To: [EMAIL PROTECTED] Subject: [PHP-DB] Sessions and MySQL? 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? = //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. *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Sessions and MySQL?
In addition to what John suggested, I see you have switched from parens to curly braces when you close your list of columns and list of values. AFAIK, you need to use parens to contain those lists. > -Original Message- > From: CPT John W. Holmes [mailto:[EMAIL PROTECTED] > Sent: Thursday, October 16, 2003 9:08 AM > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: Re: [PHP-DB] Sessions and MySQL? > > > From: <[EMAIL PROTECTED]> > > > 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['salutation']}\", > > \"$_SESSION['name'];\", > \"{$_SESSION['name']}\", > > \"$_SESSION['city'];\" > \"{$_SESSION['city']\", > > } > > ---John Holmes... > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Sessions and MySQL?
From: <[EMAIL PROTECTED]> > 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['salutation']}\", > \"$_SESSION['name'];\", \"{$_SESSION['name']}\", > \"$_SESSION['city'];\" \"{$_SESSION['city']\", > } ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Sessions and MySQL?
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? = //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. ***
Re: [PHP-DB] Sessions and MySQL
Hello Rob, Tuesday, 20 March 2001, you wrote: RW> I am trying to implement session support with mysql. I am using RW> session.set_save_handler but don't really have a great set of functions does RW> anyone have some good ones? Try http://www.phpbuilder.com/columns/ying2602.php3 Mark -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Sessions and MySQL
I am trying to implement session support with mysql. I am using session.set_save_handler but don't really have a great set of functions does anyone have some good ones? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]