[PHP-DB] Adding to an empty field
I have an empty field in a mysql database table which needs to have text inserted when my client answers an email. The code is as follows $query = 'UPDATE submissions SET answers = $array[answer] where id = $id '; // $query = $query . where id = $id ; // echo (The query is: BR$queryP\n); if (mysql_db_query ($dbname, $query, $link)){ echo (The answer was successfully inserted!BR\n); } else { echo (The answer could not be inserted! . mysql_error () . BR\n); } mysql_close ($link); The query seems to work alright, no errors showing up and The answer was successfully inserted! displayed. However, the table is not updated and I cannot see why. The same happens on another page when I try to insert a 'Y'. This script was copied from a third page which works alright. I hope someone can help. I am going mad!!!. -- Alex Francis Cameron Design 35, Drumillan Hill Greenock PA16 0XD Tel 01475 798106 [EMAIL PROTECTED] http://www.camerondesign.co.uk This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. -- 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]
Re: [PHP-DB] Adding to an empty field
Assume query looks OK when you echo it? You're not seeing a literal $id, are you? Does an id exist for $id? Is it numeric or char? Check mysql_affected_rows() - what does it return? Miles Thompson At 02:07 PM 1/31/2002 +, Alex Francis wrote: I have an empty field in a mysql database table which needs to have text inserted when my client answers an email. The code is as follows $query = 'UPDATE submissions SET answers = $array[answer] where id = $id '; // $query = $query . where id = $id ; // echo (The query is: BR$queryP\n); if (mysql_db_query ($dbname, $query, $link)){ echo (The answer was successfully inserted!BR\n); } else { echo (The answer could not be inserted! . mysql_error () . BR\n); } mysql_close ($link); The query seems to work alright, no errors showing up and The answer was successfully inserted! displayed. However, the table is not updated and I cannot see why. The same happens on another page when I try to insert a 'Y'. This script was copied from a third page which works alright. I hope someone can help. I am going mad!!!. -- Alex Francis Cameron Design 35, Drumillan Hill Greenock PA16 0XD Tel 01475 798106 [EMAIL PROTECTED] http://www.camerondesign.co.uk This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. -- 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 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]
RE: [PHP-DB] Adding to an empty field
What is $array[answer]. Should that be $array[$answer] ? -Original Message- From: Alex Francis [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 31, 2002 8:07 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Adding to an empty field I have an empty field in a mysql database table which needs to have text inserted when my client answers an email. The code is as follows $query = 'UPDATE submissions SET answers = $array[answer] where id = $id '; // $query = $query . where id = $id ; // echo (The query is: BR$queryP\n); if (mysql_db_query ($dbname, $query, $link)){ echo (The answer was successfully inserted!BR\n); } else { echo (The answer could not be inserted! . mysql_error () . BR\n); } mysql_close ($link); The query seems to work alright, no errors showing up and The answer was successfully inserted! displayed. However, the table is not updated and I cannot see why. The same happens on another page when I try to insert a 'Y'. This script was copied from a third page which works alright. I hope someone can help. I am going mad!!!. -- Alex Francis Cameron Design 35, Drumillan Hill Greenock PA16 0XD Tel 01475 798106 [EMAIL PROTECTED] http://www.camerondesign.co.uk This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. -- 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 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]
RE: [PHP-DB] Adding to an empty field
What is $array[answer]. Should that be $array[$answer] ? Second, change to: $query = 'UPDATE submissions SET answers = \.$array[$answer].\ where id = \$id\; Ya gotta quote that text. -Original Message- From: Alex Francis [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 31, 2002 8:07 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Adding to an empty field I have an empty field in a mysql database table which needs to have text inserted when my client answers an email. The code is as follows $query = 'UPDATE submissions SET answers = $array[answer] where id = $id '; // $query = $query . where id = $id ; // echo (The query is: BR$queryP\n); if (mysql_db_query ($dbname, $query, $link)){ echo (The answer was successfully inserted!BR\n); } else { echo (The answer could not be inserted! . mysql_error () . BR\n); } mysql_close ($link); The query seems to work alright, no errors showing up and The answer was successfully inserted! displayed. However, the table is not updated and I cannot see why. The same happens on another page when I try to insert a 'Y'. This script was copied from a third page which works alright. I hope someone can help. I am going mad!!!. -- Alex Francis Cameron Design 35, Drumillan Hill Greenock PA16 0XD Tel 01475 798106 [EMAIL PROTECTED] http://www.camerondesign.co.uk This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. -- 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 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]
Re: [PHP-DB] Adding to an empty field
Still having problems $array[answer] is passed from a previous page with this page. p align=rightAnswer: TEXTAREA NAME=array[answer] ROWS=8 COLS=60/TEXTAREABR ? echo (TDA HREF=\submit_answer.php?id=$idtask=submit\Submit Answer/A/TD);?/TR Have tried changing to array[$answer] on both pages without any luck. Changed the code to: $query = UPDATE submissions SET answers = \.$array[$answer].\ where id = \$id\; and added the following: echo mysql_affected_rows(); affected rows returns 0 although query returns the correct id Alex Francis Cameron Design 35, Drumillan Hill Greenock PA16 0XD Tel 01475 798106 [EMAIL PROTECTED] http://www.camerondesign.co.uk This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. Rick Emery [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... What is $array[answer]. Should that be $array[$answer] ? Second, change to: $query = 'UPDATE submissions SET answers = \.$array[$answer].\ where id = \$id\; Ya gotta quote that text. -Original Message- From: Alex Francis [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 31, 2002 8:07 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Adding to an empty field I have an empty field in a mysql database table which needs to have text inserted when my client answers an email. The code is as follows $query = 'UPDATE submissions SET answers = $array[answer] where id = $id '; // $query = $query . where id = $id ; // echo (The query is: BR$queryP\n); if (mysql_db_query ($dbname, $query, $link)){ echo (The answer was successfully inserted!BR\n); } else { echo (The answer could not be inserted! . mysql_error () . BR\n); } mysql_close ($link); The query seems to work alright, no errors showing up and The answer was successfully inserted! displayed. However, the table is not updated and I cannot see why. The same happens on another page when I try to insert a 'Y'. This script was copied from a third page which works alright. I hope someone can help. I am going mad!!!. -- Alex Francis Cameron Design 35, Drumillan Hill Greenock PA16 0XD Tel 01475 798106 [EMAIL PROTECTED] http://www.camerondesign.co.uk This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. -- 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 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]
RE: [PHP-DB] Adding to an empty field
First, you cannot have something called: TEXTAREA NAME=array[answer] ROWS=8COLS=60/TEXTAREABR That is, array[answer] is illegal and ignored. you can use: TEXTAREA NAME=array[] ROWS=8COLS=60/TEXTAREABR Then, search through $array[] for values. Help us to help you...post your HTML and your code. We promise not to steal it and use it ourselves GRIN -Original Message- From: Alex Francis [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 31, 2002 10:27 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Adding to an empty field Still having problems $array[answer] is passed from a previous page with this page. p align=rightAnswer: TEXTAREA NAME=array[answer] ROWS=8 COLS=60/TEXTAREABR ? echo (TDA HREF=\submit_answer.php?id=$idtask=submit\Submit Answer/A/TD);?/TR Have tried changing to array[$answer] on both pages without any luck. Changed the code to: $query = UPDATE submissions SET answers = \.$array[$answer].\ where id = \$id\; and added the following: echo mysql_affected_rows(); affected rows returns 0 although query returns the correct id Alex Francis Cameron Design 35, Drumillan Hill Greenock PA16 0XD Tel 01475 798106 [EMAIL PROTECTED] http://www.camerondesign.co.uk This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. Rick Emery [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... What is $array[answer]. Should that be $array[$answer] ? Second, change to: $query = 'UPDATE submissions SET answers = \.$array[$answer].\ where id = \$id\; Ya gotta quote that text. -Original Message- From: Alex Francis [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 31, 2002 8:07 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Adding to an empty field I have an empty field in a mysql database table which needs to have text inserted when my client answers an email. The code is as follows $query = 'UPDATE submissions SET answers = $array[answer] where id = $id '; // $query = $query . where id = $id ; // echo (The query is: BR$queryP\n); if (mysql_db_query ($dbname, $query, $link)){ echo (The answer was successfully inserted!BR\n); } else { echo (The answer could not be inserted! . mysql_error () . BR\n); } mysql_close ($link); The query seems to work alright, no errors showing up and The answer was successfully inserted! displayed. However, the table is not updated and I cannot see why. The same happens on another page when I try to insert a 'Y'. This script was copied from a third page which works alright. I hope someone can help. I am going mad!!!. -- Alex Francis Cameron Design 35, Drumillan Hill Greenock PA16 0XD Tel 01475 798106 [EMAIL PROTECTED] http://www.camerondesign.co.uk This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. -- 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 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 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]