RE: [PHP-DB] string compare function
post the entire line of code, (and the surrounding couple of lines?? and we'll get more of an idea. -Original Message- From: tomhilton [mailto:[EMAIL PROTECTED]] Sent: 17 January 2002 14:56 To: [EMAIL PROTECTED] Subject: [PHP-DB] string compare function Hi, I'm having a problem with the stcmp() function. I have it comparing two string variables, $pword and $conf_pword, in a script. I know they both have values, but the result always compares to 1 when $pword is the first variable in the function, and -1 when $pword is the 2nd variable in the function, no matter what string values are in the variables. It seems like the function is comparing the literal name $pword and $conf_pword, not their values. I am working on a Win98 machine, does anyone have any suggestions as to what I'm doing wrong? Any help would be greatly appreciated -- 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] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.314 / Virus Database: 175 - Release Date: 11/01/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.314 / Virus Database: 175 - Release Date: 11/01/02 -- 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] string compare function
take it you've tried having exactly the same value for each to test if the return is 0? it shouldn't be comparing literals, but it looks like it could well be! try putting round the variables, and various things like that? -Original Message- From: tomhilton [mailto:[EMAIL PROTECTED]] Sent: 17 January 2002 15:20 To: [EMAIL PROTECTED] Subject: [PHP-DB] string compare function Hi, this is more of an earlier post regarding the strcmp function and my problems with it on my Win98 machine. This is the actual code I used for the strcmp function, $errors=0; if (empty($username)||empty($pword)||empty ($conf_pword)||empty($redirect)) { echo h3Please hit your browser's back button and fill in all fields/h3; $errors++; } $comp=strcmp($conf_pword,$pword); echo $comp; The result ($comp) always comes back -1 when $pword is the 2nd variable, and +1 when $pword is the 1st variable. It doesn't matter what the input is into the variables from the form the data comes from. Is it comparing the actual literals of the variable names? -- 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] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.314 / Virus Database: 175 - Release Date: 11/01/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.314 / Virus Database: 175 - Release Date: 11/01/02 -- 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] string compare function
by the way, what are you actually trying to do with the code? there may be a different way of doing it which isn't so confusing? -Original Message- From: tomhilton [mailto:[EMAIL PROTECTED]] Sent: 17 January 2002 15:20 To: [EMAIL PROTECTED] Subject: [PHP-DB] string compare function Hi, this is more of an earlier post regarding the strcmp function and my problems with it on my Win98 machine. This is the actual code I used for the strcmp function, $errors=0; if (empty($username)||empty($pword)||empty ($conf_pword)||empty($redirect)) { echo h3Please hit your browser's back button and fill in all fields/h3; $errors++; } $comp=strcmp($conf_pword,$pword); echo $comp; The result ($comp) always comes back -1 when $pword is the 2nd variable, and +1 when $pword is the 1st variable. It doesn't matter what the input is into the variables from the form the data comes from. Is it comparing the actual literals of the variable names? -- 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] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.314 / Virus Database: 175 - Release Date: 11/01/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.314 / Virus Database: 175 - Release Date: 11/01/02 -- 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]