FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Evaluating an expression
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Evaluating an expression [message #170852] Fri, 03 December 2010 14:19 Go to next message
John is currently offline  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 Go to previous message
Captain Paralytic is currently offline  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.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Using a debugger with PHP
Next Topic: checkbox and reload a page
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 30 03:48:51 GMT 2024

Total time taken to generate the page: 0.03317 seconds