RE: [PHP] Troubles Inserting into MYSQL
If you read: http://www.php.net/manual/en/function.mysql-query.php You will see what $sql4 can be. My guess would be he is connected to 2 or more different databases, and this is specifiying which one to execute the query on. -Brad > [snip] > if ($update_type == update_Williams) { > mysql_query("INSERT INTO events ('user', 'detaildesc', 'index', 'reference', > 'date_added') VALUES (\'$cookiewho\', > \'$add_Williams\',\'\',\'$row_num\',\'$last_update\')", $sql4) > or die ("could not do update"); > } > [/snip] > > Try this > > if ($update_type == update_Williams) { > mysql_query("INSERT INTO events (user, detaildesc, index, reference, > date_added) > VALUES ('" . $cookiewho . "', '" . $add_Williams . "', '', '" . $row_num . > "', '" . $last_update . "')", $sql4) > or die ("could not do update"); > } > > First of all, seems there is extra stuff in the query that shouldn't be > there (what is $sql4?) and you may have parentheses out of place. > > HTH! > > Jay > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Troubles Inserting into MYSQL
[snip] if ($update_type == update_Williams) { mysql_query("INSERT INTO events ('user', 'detaildesc', 'index', 'reference', 'date_added') VALUES (\'$cookiewho\', \'$add_Williams\',\'\',\'$row_num\',\'$last_update\')", $sql4) or die ("could not do update"); } [/snip] Try this if ($update_type == update_Williams) { mysql_query("INSERT INTO events (user, detaildesc, index, reference, date_added) VALUES ('" . $cookiewho . "', '" . $add_Williams . "', '', '" . $row_num . "', '" . $last_update . "')", $sql4) or die ("could not do update"); } First of all, seems there is extra stuff in the query that shouldn't be there (what is $sql4?) and you may have parentheses out of place. HTH! Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Troubles Inserting into MYSQL
Ohmygosh.. That works... if ($update_type == update_Williams) { mysql_query("INSERT INTO events_Williams (user, detaildesc, indexx, reference, date_added) VALUES ('$cookiewho', '$add_Williams','','$row_num','$last_update')", $sql4) or print mysql_error(); } inserts perfectly.. Steve Gaas Sr. Systems Engineer, Carrier Markets Riverstone Networks 972.668.8329 (follow-me) 877.713.7063 (pager analog dial) [EMAIL PROTECTED] (interactive pager) http://www.rstn.net / Nasdaq: RSTN "Wisdom begins in wonder." -Socrates -Original Message- From: Brad Bonkoski [mailto:[EMAIL PROTECTED]] Sent: Sunday, September 08, 2002 2:43 PM To: Steve Gaas Cc: '[EMAIL PROTECTED]' Subject: Re: [PHP] Troubles Inserting into MYSQL Shoudn't it be: if ($update_type == update_Williams) { mysql_query("INSERT INTO events_Williams ('user', 'detaildesc', 'index', 'reference', 'date_added') VALUES ('$cookiewho','$add_Williams','','$row_num','$last_update')", $sql4) or print mysql_error(); } You need the '(' and ')' in your query to group VALUES (And what's with all the escaping with '\'? They don't appear to be needed and make it look very cluttered, i.e. not very readable. HTH -Brad Steve Gaas wrote: > > This syntax fixes the syntax error.. > > if ($update_type == update_Williams) { > mysql_query("INSERT INTO events_Williams ('user', 'detaildesc', 'index', > 'reference', 'date_added') VALUES \'$cookiewho\', > \'$add_Williams\',\'\',\'$row_num\',\'$last_update\'", $sql4) > or print mysql_error(); > } > > this is the output > You have an error in your SQL syntax near ''user', 'detaildesc', 'index', > 'reference', 'date_added') VALUES \'sgaas-wil\', ' at line 1 > > Steve Gaas > Sr. Systems Engineer, Carrier Markets > Riverstone Networks > 972.668.8329 (follow-me) > 877.713.7063 (pager analog dial) > [EMAIL PROTECTED] (interactive pager) > > http://www.rstn.net / Nasdaq: RSTN > > "Wisdom begins in wonder." -Socrates > > -Original Message- > From: Steve Gaas > Sent: Sunday, September 08, 2002 2:26 PM > To: 'Paul Nicholson'; Steve Gaas; [EMAIL PROTECTED] > Subject: RE: [PHP] Troubles Inserting into MYSQL > > Parse error: parse error, unexpected T_ECHO in > /var/www/html/actionreg/doupdate.php on line 24 > > Forgot I had that function.. I don't understand the error though.. > > Steve Gaas > Sr. Systems Engineer, Carrier Markets > Riverstone Networks > 972.668.8329 (follow-me) > 877.713.7063 (pager analog dial) > [EMAIL PROTECTED] (interactive pager) > > http://www.rstn.net / Nasdaq: RSTN > > "Wisdom begins in wonder." -Socrates > > -Original Message- > From: Paul Nicholson [mailto:[EMAIL PROTECTED]] > Sent: Sunday, September 08, 2002 2:21 PM > To: Steve Gaas; [EMAIL PROTECTED] > Subject: Re: [PHP] Troubles Inserting into MYSQL > > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hey, > Send the results of mysql_errno() please. :) > ~Pauly > > if ($update_type == update_Williams) { > mysql_query("INSERT INTO events ('user', 'detaildesc', 'index', > 'reference', 'date_added') VALUES (\'$cookiewho\', > \'$add_Williams\',\'\',\'$row_num\',\'$last_update\')", $sql4) > or echo mysql_errno()/*die ("could not do update")*/; > } > > On Sunday 08 September 2002 03:07 pm, you wrote: > > Hello, > > > > My code below always dies! I've tried just about every iteration of the > > values, etc.. Can anybody show me how to insert into MySQL a value? > > > > "INSERT INTO events ('user','detaildesc') VALUES ('$user','$details')" > > > > I just don't get it! > > > > > > if ($update_type == update_Williams) { > > mysql_query("INSERT INTO events ('user', 'detaildesc', 'index', > > 'reference', 'date_added') VALUES (\'$cookiewho\', > > \'$add_Williams\',\'\',\'$row_num\',\'$last_update\')", $sql4) > > or die ("could not do update"); > > } > > - -- > ~Paul Nicholson > Design Specialist @ WebPower Design > "The webthe way you want it!" > [EMAIL PROTECTED] > > "It said uses Windows 98 or better, so I loaded Linux!" > Registered Linux User #183202 using Register Linux System # 81891 > -BEGIN PGP SIGNATURE- > Version: GnuPG v1.0.6 (GNU/Linux) > Comment: For info see http://www.gnupg.org > > iD8DBQE9e6McDyXNIUN3+UQRAriZAKCTPYsBfypW7N6k8vpG+UDJEZ77BQCfVtEi > BmSkmFZDBbXuAm+g3nvw/tc= > =InFX > -END PGP SIGNATURE- > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Troubles Inserting into MYSQL
Shoudn't it be: if ($update_type == update_Williams) { mysql_query("INSERT INTO events_Williams ('user', 'detaildesc', 'index', 'reference', 'date_added') VALUES ('$cookiewho','$add_Williams','','$row_num','$last_update')", $sql4) or print mysql_error(); } You need the '(' and ')' in your query to group VALUES (And what's with all the escaping with '\'? They don't appear to be needed and make it look very cluttered, i.e. not very readable. HTH -Brad Steve Gaas wrote: > > This syntax fixes the syntax error.. > > if ($update_type == update_Williams) { > mysql_query("INSERT INTO events_Williams ('user', 'detaildesc', 'index', > 'reference', 'date_added') VALUES \'$cookiewho\', > \'$add_Williams\',\'\',\'$row_num\',\'$last_update\'", $sql4) > or print mysql_error(); > } > > this is the output > You have an error in your SQL syntax near ''user', 'detaildesc', 'index', > 'reference', 'date_added') VALUES \'sgaas-wil\', ' at line 1 > > Steve Gaas > Sr. Systems Engineer, Carrier Markets > Riverstone Networks > 972.668.8329 (follow-me) > 877.713.7063 (pager analog dial) > [EMAIL PROTECTED] (interactive pager) > > http://www.rstn.net / Nasdaq: RSTN > > "Wisdom begins in wonder." -Socrates > > -Original Message- > From: Steve Gaas > Sent: Sunday, September 08, 2002 2:26 PM > To: 'Paul Nicholson'; Steve Gaas; [EMAIL PROTECTED] > Subject: RE: [PHP] Troubles Inserting into MYSQL > > Parse error: parse error, unexpected T_ECHO in > /var/www/html/actionreg/doupdate.php on line 24 > > Forgot I had that function.. I don't understand the error though.. > > Steve Gaas > Sr. Systems Engineer, Carrier Markets > Riverstone Networks > 972.668.8329 (follow-me) > 877.713.7063 (pager analog dial) > [EMAIL PROTECTED] (interactive pager) > > http://www.rstn.net / Nasdaq: RSTN > > "Wisdom begins in wonder." -Socrates > > -Original Message- > From: Paul Nicholson [mailto:[EMAIL PROTECTED]] > Sent: Sunday, September 08, 2002 2:21 PM > To: Steve Gaas; [EMAIL PROTECTED] > Subject: Re: [PHP] Troubles Inserting into MYSQL > > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hey, > Send the results of mysql_errno() please. :) > ~Pauly > > if ($update_type == update_Williams) { > mysql_query("INSERT INTO events ('user', 'detaildesc', 'index', > 'reference', 'date_added') VALUES (\'$cookiewho\', > \'$add_Williams\',\'\',\'$row_num\',\'$last_update\')", $sql4) > or echo mysql_errno()/*die ("could not do update")*/; > } > > On Sunday 08 September 2002 03:07 pm, you wrote: > > Hello, > > > > My code below always dies! I've tried just about every iteration of the > > values, etc.. Can anybody show me how to insert into MySQL a value? > > > > "INSERT INTO events ('user','detaildesc') VALUES ('$user','$details')" > > > > I just don't get it! > > > > > > if ($update_type == update_Williams) { > > mysql_query("INSERT INTO events ('user', 'detaildesc', 'index', > > 'reference', 'date_added') VALUES (\'$cookiewho\', > > \'$add_Williams\',\'\',\'$row_num\',\'$last_update\')", $sql4) > > or die ("could not do update"); > > } > > - -- > ~Paul Nicholson > Design Specialist @ WebPower Design > "The webthe way you want it!" > [EMAIL PROTECTED] > > "It said uses Windows 98 or better, so I loaded Linux!" > Registered Linux User #183202 using Register Linux System # 81891 > -BEGIN PGP SIGNATURE- > Version: GnuPG v1.0.6 (GNU/Linux) > Comment: For info see http://www.gnupg.org > > iD8DBQE9e6McDyXNIUN3+UQRAriZAKCTPYsBfypW7N6k8vpG+UDJEZ77BQCfVtEi > BmSkmFZDBbXuAm+g3nvw/tc= > =InFX > -END PGP SIGNATURE- > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Troubles Inserting into MYSQL
This syntax fixes the syntax error.. if ($update_type == update_Williams) { mysql_query("INSERT INTO events_Williams ('user', 'detaildesc', 'index', 'reference', 'date_added') VALUES \'$cookiewho\', \'$add_Williams\',\'\',\'$row_num\',\'$last_update\'", $sql4) or print mysql_error(); } this is the output You have an error in your SQL syntax near ''user', 'detaildesc', 'index', 'reference', 'date_added') VALUES \'sgaas-wil\', ' at line 1 Steve Gaas Sr. Systems Engineer, Carrier Markets Riverstone Networks 972.668.8329 (follow-me) 877.713.7063 (pager analog dial) [EMAIL PROTECTED] (interactive pager) http://www.rstn.net / Nasdaq: RSTN "Wisdom begins in wonder." -Socrates -Original Message- From: Steve Gaas Sent: Sunday, September 08, 2002 2:26 PM To: 'Paul Nicholson'; Steve Gaas; [EMAIL PROTECTED] Subject: RE: [PHP] Troubles Inserting into MYSQL Parse error: parse error, unexpected T_ECHO in /var/www/html/actionreg/doupdate.php on line 24 Forgot I had that function.. I don't understand the error though.. Steve Gaas Sr. Systems Engineer, Carrier Markets Riverstone Networks 972.668.8329 (follow-me) 877.713.7063 (pager analog dial) [EMAIL PROTECTED] (interactive pager) http://www.rstn.net / Nasdaq: RSTN "Wisdom begins in wonder." -Socrates -Original Message- From: Paul Nicholson [mailto:[EMAIL PROTECTED]] Sent: Sunday, September 08, 2002 2:21 PM To: Steve Gaas; [EMAIL PROTECTED] Subject: Re: [PHP] Troubles Inserting into MYSQL -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hey, Send the results of mysql_errno() please. :) ~Pauly if ($update_type == update_Williams) { mysql_query("INSERT INTO events ('user', 'detaildesc', 'index', 'reference', 'date_added') VALUES (\'$cookiewho\', \'$add_Williams\',\'\',\'$row_num\',\'$last_update\')", $sql4) or echo mysql_errno()/*die ("could not do update")*/; } On Sunday 08 September 2002 03:07 pm, you wrote: > Hello, > > My code below always dies! I've tried just about every iteration of the > values, etc.. Can anybody show me how to insert into MySQL a value? > > "INSERT INTO events ('user','detaildesc') VALUES ('$user','$details')" > > I just don't get it! > > > if ($update_type == update_Williams) { > mysql_query("INSERT INTO events ('user', 'detaildesc', 'index', > 'reference', 'date_added') VALUES (\'$cookiewho\', > \'$add_Williams\',\'\',\'$row_num\',\'$last_update\')", $sql4) > or die ("could not do update"); > } - -- ~Paul Nicholson Design Specialist @ WebPower Design "The webthe way you want it!" [EMAIL PROTECTED] "It said uses Windows 98 or better, so I loaded Linux!" Registered Linux User #183202 using Register Linux System # 81891 -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE9e6McDyXNIUN3+UQRAriZAKCTPYsBfypW7N6k8vpG+UDJEZ77BQCfVtEi BmSkmFZDBbXuAm+g3nvw/tc= =InFX -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Troubles Inserting into MYSQL
Parse error: parse error, unexpected T_ECHO in /var/www/html/actionreg/doupdate.php on line 24 Forgot I had that function.. I don't understand the error though.. Steve Gaas Sr. Systems Engineer, Carrier Markets Riverstone Networks 972.668.8329 (follow-me) 877.713.7063 (pager analog dial) [EMAIL PROTECTED] (interactive pager) http://www.rstn.net / Nasdaq: RSTN "Wisdom begins in wonder." -Socrates -Original Message- From: Paul Nicholson [mailto:[EMAIL PROTECTED]] Sent: Sunday, September 08, 2002 2:21 PM To: Steve Gaas; [EMAIL PROTECTED] Subject: Re: [PHP] Troubles Inserting into MYSQL -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hey, Send the results of mysql_errno() please. :) ~Pauly if ($update_type == update_Williams) { mysql_query("INSERT INTO events ('user', 'detaildesc', 'index', 'reference', 'date_added') VALUES (\'$cookiewho\', \'$add_Williams\',\'\',\'$row_num\',\'$last_update\')", $sql4) or echo mysql_errno()/*die ("could not do update")*/; } On Sunday 08 September 2002 03:07 pm, you wrote: > Hello, > > My code below always dies! I've tried just about every iteration of the > values, etc.. Can anybody show me how to insert into MySQL a value? > > "INSERT INTO events ('user','detaildesc') VALUES ('$user','$details')" > > I just don't get it! > > > if ($update_type == update_Williams) { > mysql_query("INSERT INTO events ('user', 'detaildesc', 'index', > 'reference', 'date_added') VALUES (\'$cookiewho\', > \'$add_Williams\',\'\',\'$row_num\',\'$last_update\')", $sql4) > or die ("could not do update"); > } - -- ~Paul Nicholson Design Specialist @ WebPower Design "The webthe way you want it!" [EMAIL PROTECTED] "It said uses Windows 98 or better, so I loaded Linux!" Registered Linux User #183202 using Register Linux System # 81891 -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE9e6McDyXNIUN3+UQRAriZAKCTPYsBfypW7N6k8vpG+UDJEZ77BQCfVtEi BmSkmFZDBbXuAm+g3nvw/tc= =InFX -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Troubles Inserting into MYSQL
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hey, Send the results of mysql_errno() please. :) ~Pauly if ($update_type == update_Williams) { mysql_query("INSERT INTO events ('user', 'detaildesc', 'index', 'reference', 'date_added') VALUES (\'$cookiewho\', \'$add_Williams\',\'\',\'$row_num\',\'$last_update\')", $sql4) or echo mysql_errno()/*die ("could not do update")*/; } On Sunday 08 September 2002 03:07 pm, you wrote: > Hello, > > My code below always dies! I've tried just about every iteration of the > values, etc.. Can anybody show me how to insert into MySQL a value? > > "INSERT INTO events ('user','detaildesc') VALUES ('$user','$details')" > > I just don't get it! > > > if ($update_type == update_Williams) { > mysql_query("INSERT INTO events ('user', 'detaildesc', 'index', > 'reference', 'date_added') VALUES (\'$cookiewho\', > \'$add_Williams\',\'\',\'$row_num\',\'$last_update\')", $sql4) > or die ("could not do update"); > } - -- ~Paul Nicholson Design Specialist @ WebPower Design "The webthe way you want it!" [EMAIL PROTECTED] "It said uses Windows 98 or better, so I loaded Linux!" Registered Linux User #183202 using Register Linux System # 81891 -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE9e6McDyXNIUN3+UQRAriZAKCTPYsBfypW7N6k8vpG+UDJEZ77BQCfVtEi BmSkmFZDBbXuAm+g3nvw/tc= =InFX -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Troubles Inserting into MYSQL
Hello, My code below always dies! I've tried just about every iteration of the values, etc.. Can anybody show me how to insert into MySQL a value? "INSERT INTO events ('user','detaildesc') VALUES ('$user','$details')" I just don't get it! if ($update_type == update_Williams) { mysql_query("INSERT INTO events ('user', 'detaildesc', 'index', 'reference', 'date_added') VALUES (\'$cookiewho\', \'$add_Williams\',\'\',\'$row_num\',\'$last_update\')", $sql4) or die ("could not do update"); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php