Fw: [PHP-DB] whats wrong with my sql insert statement?
Try remove (;) at the end of the expresion, before quote (): VALUES ('$first_name','$location','$phone', '$blabla')...(;)... - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, September 10, 2002 4:38 AM Subject: Re: [PHP-DB] whats wrong with my sql insert statement? Thanks for your suggestions. first my /etc/php.ini register_globals = on second i made the change as you suggested and i added a [$blabla = truly random;] when the input.php is excuated, 'blabla' value is inserted into the table. '$first_name' is still left blank. this leads me to believe that '$first_name' is blank to start with! somehow the input.html gives input.php blank $first_name , $location . care to look at my input.html ? thanks alot. # ?php $db_name =cheese_catalog; $table_name = user; $blabla = bla bla; $connection = @mysql_connect(localhost,test,new0pass) or die(Couldn't Connect.); $db = @mysql_select_db($db_name, $connection) or die(Couldn't select database.); if (none_required==none_required) { $sql = INSERT INTO $table_name (first_name,location,phone,messages) VALUES ('$first_name','$location','$phone', '$blabla');; $result = @mysql_query($sql, $connection) or die(Error #. mysql_errno() . : . mysql_error()); include(input_added.html); } ? # Michael Hazelden wrote: Hi there, Two things: (a) in my experience - you should use single quotes in your query to surround the values and so you don't need to escape them either (e.g. '$first_name') and (b) Make sure register_globals is on - otherwise you need to use $_POST[first_name] Cheers, Michael. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: 10 September 2002 01:15 To: [EMAIL PROTECTED] Subject: [PHP-DB] whats wrong with my sql insert statement? Hi I am using redhat 7.3 with mysql-3.23.49-3 php-4.1.2-7.3.4 apache-1.3.23-11. I want to insert few values into a mysql table. This input.php sort works. it will add a new entray to the table but with blank values. What did I do wrong? # # # file name input.php ?php $db_name =cheese_catalog; $table_name = user; $connection = @mysql_connect(localhost,test,test) or die(Couldn't Connect.); $db = @mysql_select_db($db_name, $connection) or die(Couldn't select database.); if (none_required==none_required) { $sql = INSERT INTO $table_name (first_name,location,phone,messages) VALUES (\$first_name\,\$location\,\$phone\, \$messages\);; $result = @mysql_query($sql, $connection) or die(Error #. mysql_errno() . : . mysql_error()); include(input_added.html); } ? # # file name input.html # html head titleNew Record/title /head body pPlease fill out the following information:/p form method=post action=input.php enctype=multipart/form-data table width=100% border=0 cellspacing=3 cellpadding=3 tr td width=25%first_name:/td td width=75%input name=first_name type=text size=40 maxlength=255 value=/td /tr tr td width=25%location:/td td width=75%input name=location type=text size=40 maxlength=255 value=/td /tr tr td width=25%phone:/td td width=75%input name=phone type=text size=40 maxlength=255 value=/td /tr tr td width=25%messages:/td td width=75%input name=messages type=text size=40 maxlength=255 value=/td /tr tr td width=25%nbsp;/td td width=75% align=leftinput type=submit name=submit value=Enternbspinput type=reset name=reset/td /tr /table /form /body /html # # -- 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: Fw: [PHP-DB] whats wrong with my sql insert statement?
my input.html has errors in it. wrong form method=post action=input.php enctype=multipart/form-data correct form method=POST action=input.php strange thing is it used to work. anyhow thanks for the help. Nikos wrote: Try remove (;) at the end of the expresion, before quote (): VALUES ('$first_name','$location','$phone', '$blabla')...(;)... - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, September 10, 2002 4:38 AM Subject: Re: [PHP-DB] whats wrong with my sql insert statement? Thanks for your suggestions. first my /etc/php.ini register_globals = on second i made the change as you suggested and i added a [$blabla = truly random;] when the input.php is excuated, 'blabla' value is inserted into the table. '$first_name' is still left blank. this leads me to believe that '$first_name' is blank to start with! somehow the input.html gives input.php blank $first_name , $location . care to look at my input.html ? thanks alot. # ?php $db_name =cheese_catalog; $table_name = user; $blabla = bla bla; $connection = @mysql_connect(localhost,test,new0pass) or die(Couldn't Connect.); $db = @mysql_select_db($db_name, $connection) or die(Couldn't select database.); if (none_required==none_required) { $sql = INSERT INTO $table_name (first_name,location,phone,messages) VALUES ('$first_name','$location','$phone', '$blabla');; $result = @mysql_query($sql, $connection) or die(Error #. mysql_errno() . : . mysql_error()); include(input_added.html); } ? # Michael Hazelden wrote: Hi there, Two things: (a) in my experience - you should use single quotes in your query to surround the values and so you don't need to escape them either (e.g. '$first_name') and (b) Make sure register_globals is on - otherwise you need to use $_POST[first_name] Cheers, Michael. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: 10 September 2002 01:15 To: [EMAIL PROTECTED] Subject: [PHP-DB] whats wrong with my sql insert statement? Hi I am using redhat 7.3 with mysql-3.23.49-3 php-4.1.2-7.3.4 apache-1.3.23-11. I want to insert few values into a mysql table. This input.php sort works. it will add a new entray to the table but with blank values. What did I do wrong? # # # file name input.php ?php $db_name =cheese_catalog; $table_name = user; $connection = @mysql_connect(localhost,test,test) or die(Couldn't Connect.); $db = @mysql_select_db($db_name, $connection) or die(Couldn't select database.); if (none_required==none_required) { $sql = INSERT INTO $table_name (first_name,location,phone,messages) VALUES (\$first_name\,\$location\,\$phone\, \$messages\);; $result = @mysql_query($sql, $connection) or die(Error #. mysql_errno() . : . mysql_error()); include(input_added.html); } ? # # file name input.html # html head titleNew Record/title /head body pPlease fill out the following information:/p form method=post action=input.php enctype=multipart/form-data table width=100% border=0 cellspacing=3 cellpadding=3 tr td width=25%first_name:/td td width=75%input name=first_name type=text size=40 maxlength=255 value=/td /tr tr td width=25%location:/td td width=75%input name=location type=text size=40 maxlength=255 value=/td /tr tr td width=25%phone:/td td width=75%input name=phone type=text size=40 maxlength=255 value=/td /tr tr td width=25%messages:/td td width=75%input name=messages type=text size=40 maxlength=255 value=/td /tr tr td width=25%nbsp;/td td width=75% align=leftinput type=submit name=submit value=Enternbspinput type=reset name=reset/td /tr /table /form /body /html # # -- 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
[PHP-DB] whats wrong with my sql insert statement?
Hi I am using redhat 7.3 with mysql-3.23.49-3 php-4.1.2-7.3.4 apache-1.3.23-11. I want to insert few values into a mysql table. This input.php sort works. it will add a new entray to the table but with blank values. What did I do wrong? # # # file name input.php ?php $db_name =cheese_catalog; $table_name = user; $connection = mysql_connect(localhost,test,test) or die(Couldn't Connect.); $db = mysql_select_db($db_name, $connection) or die(Couldn't select database.); if (none_required==none_required) { $sql = INSERT INTO $table_name (first_name,location,phone,messages) VALUES (\$first_name\,\$location\,\$phone\, \$messages\);; $result = mysql_query($sql, $connection) or die(Error #. mysql_errno() . : . mysql_error()); include(input_added.html); } ? # # file name input.html # html head titleNew Record/title /head body pPlease fill out the following information:/p form method=post action=input.php enctype=multipart/form-data table width=100% border=0 cellspacing=3 cellpadding=3 tr td width=25%first_name:/td td width=75%input name=first_name type=text size=40 maxlength=255 value=/td /tr tr td width=25%location:/td td width=75%input name=location type=text size=40 maxlength=255 value=/td /tr tr td width=25%phone:/td td width=75%input name=phone type=text size=40 maxlength=255 value=/td /tr tr td width=25%messages:/td td width=75%input name=messages type=text size=40 maxlength=255 value=/td /tr tr td width=25%nbsp;/td td width=75% align=leftinput type=submit name=submit value=Enternbspinput type=reset name=reset/td /tr /table /form /body /html # # -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] whats wrong with my sql insert statement?
Hi there, Two things: (a) in my experience - you should use single quotes in your query to surround the values and so you don't need to escape them either (e.g. '$first_name') and (b) Make sure register_globals is on - otherwise you need to use $_POST[first_name] Cheers, Michael. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: 10 September 2002 01:15 To: [EMAIL PROTECTED] Subject: [PHP-DB] whats wrong with my sql insert statement? Hi I am using redhat 7.3 with mysql-3.23.49-3 php-4.1.2-7.3.4 apache-1.3.23-11. I want to insert few values into a mysql table. This input.php sort works. it will add a new entray to the table but with blank values. What did I do wrong? # # # file name input.php ?php $db_name =cheese_catalog; $table_name = user; $connection = @mysql_connect(localhost,test,test) or die(Couldn't Connect.); $db = @mysql_select_db($db_name, $connection) or die(Couldn't select database.); if (none_required==none_required) { $sql = INSERT INTO $table_name (first_name,location,phone,messages) VALUES (\$first_name\,\$location\,\$phone\, \$messages\);; $result = @mysql_query($sql, $connection) or die(Error #. mysql_errno() . : . mysql_error()); include(input_added.html); } ? # # file name input.html # html head titleNew Record/title /head body pPlease fill out the following information:/p form method=post action=input.php enctype=multipart/form-data table width=100% border=0 cellspacing=3 cellpadding=3 tr td width=25%first_name:/td td width=75%input name=first_name type=text size=40 maxlength=255 value=/td /tr tr td width=25%location:/td td width=75%input name=location type=text size=40 maxlength=255 value=/td /tr tr td width=25%phone:/td td width=75%input name=phone type=text size=40 maxlength=255 value=/td /tr tr td width=25%messages:/td td width=75%input name=messages type=text size=40 maxlength=255 value=/td /tr tr td width=25%nbsp;/td td width=75% align=leftinput type=submit name=submit value=Enternbspinput type=reset name=reset/td /tr /table /form /body /html # # -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ This message has been checked for all known viruses by the MessageLabs Virus Control Centre. This message has been checked for all known viruses by the MessageLabs Virus Control Centre. * Notice: This email is confidential and may contain copyright material of Ocado Limited (the Company). Opinions and views expressed in this message may not necessarily reflect the opinions and views of the Company. If you are not the intended recipient, please notify us immediately and delete all copies of this message. Please note that it is your responsibility to scan this message for viruses. Company reg. no. 3875000. Swallowdale Lane, Hemel Hempstead HP2 7PY * -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] whats wrong with my sql insert statement?
Thanks for your suggestions. first my /etc/php.ini register_globals = on second i made the change as you suggested and i added a [$blabla = truly random;] when the input.php is excuated, 'blabla' value is inserted into the table. '$first_name' is still left blank. this leads me to believe that '$first_name' is blank to start with! somehow the input.html gives input.php blank $first_name , $location . care to look at my input.html ? thanks alot. # ?php $db_name =cheese_catalog; $table_name = user; $blabla = bla bla; $connection = @mysql_connect(localhost,test,new0pass) or die(Couldn't Connect.); $db = @mysql_select_db($db_name, $connection) or die(Couldn't select database.); if (none_required==none_required) { $sql = INSERT INTO $table_name (first_name,location,phone,messages) VALUES ('$first_name','$location','$phone', '$blabla');; $result = @mysql_query($sql, $connection) or die(Error #. mysql_errno() . : . mysql_error()); include(input_added.html); } ? # Michael Hazelden wrote: Hi there, Two things: (a) in my experience - you should use single quotes in your query to surround the values and so you don't need to escape them either (e.g. '$first_name') and (b) Make sure register_globals is on - otherwise you need to use $_POST[first_name] Cheers, Michael. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: 10 September 2002 01:15 To: [EMAIL PROTECTED] Subject: [PHP-DB] whats wrong with my sql insert statement? Hi I am using redhat 7.3 with mysql-3.23.49-3 php-4.1.2-7.3.4 apache-1.3.23-11. I want to insert few values into a mysql table. This input.php sort works. it will add a new entray to the table but with blank values. What did I do wrong? # # # file name input.php ?php $db_name =cheese_catalog; $table_name = user; $connection = @mysql_connect(localhost,test,test) or die(Couldn't Connect.); $db = @mysql_select_db($db_name, $connection) or die(Couldn't select database.); if (none_required==none_required) { $sql = INSERT INTO $table_name (first_name,location,phone,messages) VALUES (\$first_name\,\$location\,\$phone\, \$messages\);; $result = @mysql_query($sql, $connection) or die(Error #. mysql_errno() . : . mysql_error()); include(input_added.html); } ? # # file name input.html # html head titleNew Record/title /head body pPlease fill out the following information:/p form method=post action=input.php enctype=multipart/form-data table width=100% border=0 cellspacing=3 cellpadding=3 tr td width=25%first_name:/td td width=75%input name=first_name type=text size=40 maxlength=255 value=/td /tr tr td width=25%location:/td td width=75%input name=location type=text size=40 maxlength=255 value=/td /tr tr td width=25%phone:/td td width=75%input name=phone type=text size=40 maxlength=255 value=/td /tr tr td width=25%messages:/td td width=75%input name=messages type=text size=40 maxlength=255 value=/td /tr tr td width=25%nbsp;/td td width=75% align=leftinput type=submit name=submit value=Enternbspinput type=reset name=reset/td /tr /table /form /body /html # # -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php