Evaluating an expression [message #170852] |
Fri, 03 December 2010 14:19 |
John
Messages: 18 Registered: September 2010
Karma: 0
|
Junior Member |
|
|
Clutching at straws here but I have a problem that seems to occur if
the web users browser/system 'goes down' i.e. not very often.
My specific question is, do these two expressions always equate to the
same thing?
if ($o1) {
and
if ($o1 == 1) {
The variable is set as follows just before the above code:
$o1 = $sql -> cust_comp;
cust-comp is tinyint(1) default to zero on the database.
The code allows someone to partially complete an order and then go
back later until the order is sent. The cust_comp field is then
written to the database with a value of 1. When customers continue
processing (straight away or after logging in again) the system reads
this value and assumes they want to now place a new order and
processing continues with the new order.
The problem I am getting is that the system seems to think the first
order is complete when it is not (cust_comp is 0 on the database entry
for the first order) and therefore starts a new one with the customer
losing their previous order details.
Hope that all makes sense. Really don't know where to look for this at
the moment so any help gratefully accepted. I suspect the error may be
elsewhere but I thought I would check this first.
--
John
|
|
|
Re: Evaluating an expression [message #170853 is a reply to message #170852] |
Fri, 03 December 2010 14:50 |
Captain Paralytic
Messages: 204 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On Dec 3, 2:19 pm, John <67fthu6o@kjkhfv> wrote:
> Clutching at straws here but I have a problem that seems to occur if
> the web users browser/system 'goes down' i.e. not very often.
>
> My specific question is, do these two expressions always equate to the
> same thing?
>
> if ($o1) {
>
> and
>
> if ($o1 == 1) {
>
> The variable is set as follows just before the above code:
>
> $o1 = $sql -> cust_comp;
>
> cust-comp is tinyint(1) default to zero on the database.
>
> The code allows someone to partially complete an order and then go
> back later until the order is sent. The cust_comp field is then
> written to the database with a value of 1. When customers continue
> processing (straight away or after logging in again) the system reads
> this value and assumes they want to now place a new order and
> processing continues with the new order.
>
> The problem I am getting is that the system seems to think the first
> order is complete when it is not (cust_comp is 0 on the database entry
> for the first order) and therefore starts a new one with the customer
> losing their previous order details.
>
> Hope that all makes sense. Really don't know where to look for this at
> the moment so any help gratefully accepted. I suspect the error may be
> elsewhere but I thought I would check this first.
>
> --
> John
($o1) is true for pretty much any value of $o1 except for false, 0,
'', whereas ($o1 == 1) is true only when $o1 is either 1 or '1', so
they do not by any means always relate to the same thing.
|
|
|