RE: [PHP] Baffled, line producing error
What is the exact error message are you seeing? -Original Message- From: Craig Vincent [mailto:[EMAIL PROTECTED]] Sent: Saturday, June 01, 2002 11:29 PM To: [EMAIL PROTECTED] Subject: [PHP] Baffled, line producing error I was happily coding when I came across a mysterious error. I've traced it to this line if ($player_password != $player_password_verify) { $errmsg .= 'Password don't match. Please try againBR'; $error = 1; } commented out the script runs fine, if this line is active an error is produced. My eyes are going bug eyed trying to find what the problem is and I'm hoping a second pair of eyes may point out my error. I've provided the entire script in case by chance the error is actually stemming from elsewhere in the script and I'm missing that as well. The error message from the compiler states the error is stemming from line 15 (which is the line I posted above). Any suggestions? ?php require('config.inc.php'); authenticate(); if ($action == 'add') { // The connection/query commands will need to be modified once the db abstraction layer is ready mysql_connect($mysql_host, $mysql_user, $mysql_pass); mysql_select_db($mysql_database); $errmsg = ''; if (mysql_num_rows(mysql_query(SELECT player_id FROM eq_guildmembers WHERE player_name = '$player_name')) 0) { $errmsg .= 'Player name already existsBR'; $error = 1; } if (!$player_password) { $errmsg .= 'You must specify a password for this userBR'; $error = 1; } # For some weird reason the line below produces an error...I can't find anything wrong if ($player_password != $player_password_verify) { $errmsg .= 'Password don't match. Please try againBR'; $error = 1; } if (!$error) { mysql_query(INSERT INTO eq_guildmembers (player_name, date_joined, player_email_address, player_icq, priv_admin, player_password) VALUES ('$player_name',NOW(), '$player_email_address','$player_icq','$priv_admin','$p layer_password')); else { echo 'Submission successful...A HREF=admin_roster.phpclick here to return to the roster/A'; exit; } } } ? -- 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] Baffled, line producing error
If the error is a warning about undefined variable, then set a default value for $errmsg before you start adding strings to it. $errmsg .= this; That by itself means $errmsg = $errmsg . this;, but if $errmsg isnt' defined, you'll get the warning. Set $errmsg = ''; at the beginning of your script if that is the problem... For future reference, always give the exact error when posting. Trying to be psychic, ---John Holmes... -Original Message- From: Craig Vincent [mailto:[EMAIL PROTECTED]] Sent: Saturday, June 01, 2002 11:29 PM To: [EMAIL PROTECTED] Subject: [PHP] Baffled, line producing error I was happily coding when I came across a mysterious error. I've traced it to this line if ($player_password != $player_password_verify) { $errmsg .= 'Password don't match. Please try againBR'; $error = 1; } commented out the script runs fine, if this line is active an error is produced. My eyes are going bug eyed trying to find what the problem is and I'm hoping a second pair of eyes may point out my error. I've provided the entire script in case by chance the error is actually stemming from elsewhere in the script and I'm missing that as well. The error message from the compiler states the error is stemming from line 15 (which is the line I posted above). Any suggestions? ?php require('config.inc.php'); authenticate(); if ($action == 'add') { // The connection/query commands will need to be modified once the db abstraction layer is ready mysql_connect($mysql_host, $mysql_user, $mysql_pass); mysql_select_db($mysql_database); $errmsg = ''; if (mysql_num_rows(mysql_query(SELECT player_id FROM eq_guildmembers WHERE player_name = '$player_name')) 0) { $errmsg .= 'Player name already existsBR'; $error = 1; } if (!$player_password) { $errmsg .= 'You must specify a password for this userBR'; $error = 1; } # For some weird reason the line below produces an error...I can't find anything wrong if ($player_password != $player_password_verify) { $errmsg .= 'Password don't match. Please try againBR'; $error = 1; } if (!$error) { mysql_query(INSERT INTO eq_guildmembers (player_name, date_joined, player_email_address, player_icq, priv_admin, player_password) VALUES ('$player_name',NOW(), '$player_email_address','$player_icq','$priv_admin','$player_password') ); else { echo 'Submission successful...A HREF=admin_roster.phpclick here to return to the roster/A'; exit; } } } ? -- 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] Baffled, line producing error
If the error is a warning about undefined variable, then set a default value for $errmsg before you start adding strings to it. $errmsg .= this; That by itself means $errmsg = $errmsg . this;, but if $errmsg isnt' defined, you'll get the warning. Set $errmsg = ''; at the beginning of your script if that is the problem... For future reference, always give the exact error when posting. Trying to be psychic, You'll notice a few lines up I have defined $errmsg =) It's a standard parsing error I'm getting Parse error: parse error in admin_add_player.php on line 15 Since this message does not arise when line 15 is removed I can only assume the error is actually on that line and not a missing quote or bracket somewhere else in the script. Sincerely, Craig Vincent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Baffled, line producing error
You have: if ($player_password != $player_password_verify) { $errmsg .= 'Password don't match. Please try againBR'; $error = 1; } Notice the ' inside the '', this is bad syntax. For more information on using strings in PHP, see: http://www.zend.com/zend/tut/using-strings.php http://www.php.net/manual/en/language.types.string.php One thing you can do is escape it: \' regards, Philip Olson On Sun, 2 Jun 2002, Craig Vincent wrote: If the error is a warning about undefined variable, then set a default value for $errmsg before you start adding strings to it. $errmsg .= this; That by itself means $errmsg = $errmsg . this;, but if $errmsg isnt' defined, you'll get the warning. Set $errmsg = ''; at the beginning of your script if that is the problem... For future reference, always give the exact error when posting. Trying to be psychic, You'll notice a few lines up I have defined $errmsg =) It's a standard parsing error I'm getting Parse error: parse error in admin_add_player.php on line 15 Since this message does not arise when line 15 is removed I can only assume the error is actually on that line and not a missing quote or bracket somewhere else in the script. Sincerely, Craig Vincent -- 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] Baffled, line producing error
Notice the ' inside the '', this is bad syntax. For more information on using strings in PHP, see: Sheesh you're right, as I said it was probably a dumb error, three other people have looked at this that I'm aware of and missed it toolol glad your eyes are better than ours. Thank you for pointing out the mistake Sincerely, Craig Vincent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php