RE: [PHP] perplexed as to why this is happening...
| From: | Michael Hazelden | Date: | Mon, 25 Nov 2002 00:44:18 +0000 |
| Subject: | RE: [PHP] perplexed as to why this is happening... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-125849@lists.php.net to get a copy of this message | ||
Ahem ...
$sec=1 means "set $sec to 1"
You want
$sec==1
:-)
M.
-----Original Message-----
From: Peter Houchin [mailto:php@vfsa.com.au]
Sent: 25 November 2002 00:53
To: php_gen
Subject: [PHP] perplexed as to why this is happening...
Howdy,
I'm doing a simple db check.. grabbing a db value, in this case $sec, based
on the user name registered in the session,
I've created a user called test with $sec equal to "2" but when i get to
the second echo of $sec the value has changed to "1" and I can't understand
why... can some one please give me some idea as to why this is happening?
elseif ($_POST['cost'] >=100001){
//query db
$res = mysql_query("SELECT sec FROM users WHERE uname='$_SESSION[uname]'");
$num = mysql_numrows($res) ;
if ($num == 1) {
//get results
$sec = mysql_result($res, 0, 'sec');
echo $sec; // pulls out sec as 2 ( as is sposed to )
}
if (!$sec = "1"){
echo "<font class='content'>please contact your nearest
representive</font>";
}
else {
echo $sec; // on this echo $sec has changed value from 2 to 1
Cheers
Peter
"the only dumb question is the one that wasn't asked"
--
PHP General 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
*********************************************************************