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 again<BR>'; $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
> exists<BR>'; $error = 1; }
> if (!$player_password) { $errmsg .= 'You must specify a password for
this
> user<BR>'; $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 again<BR>'; $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.php">click
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

Reply via email to