Evaluating an expression

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
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) {


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.


Re: Evaluating an expression

Quoted text here. Click to load it

($o1) is true for pretty much any value of $o1 except for false, 0,
'', whereas ($o1 =3D 1) is true only when $o1 is either 1 or '1', so
they do not by any means always relate to the same thing.

Site Timeline