RE: Variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It would seem that your IF statement, as it is written below, evaluates to
true every time because I'm guessing that the hexadecimal value of the
string timeb is larger than the hexadecimal value of timea. Like I said,
just a guess.

I'm also guessing that you actually want to compare two values from your
database when you do your if ($tim1 < $tim2). Assuming that timea and timeb
are columns in your database and are included in the $result of your query,
can you just do: 

if($myrow["timea"] < $myrow["timeb"]){
	do stuff;
} 

HTH

> -----Original Message-----
> From: Steve Dodkins [mailto:Steve.Dodkins@ebm-ziehl.co.uk]
> Sent: Friday, November 08, 2002 9:26 AM
> To: Php-Db (E-mail)
> Subject:  Variables
> 
> 
> Hi
> 
> The following will print the variables ($tim1 and $tim2) 
> correctly but the
> IF statement using the same vars will not work, it will only 
> work as below
> which seems to work by comparing the text values of the 2 
> variables $tim1
> $tim2.
> 
> while($myrow = mysql_fetch_array($result))
> 
> {
> $tim1="timea";
> $tim2="timeb";
> if ($tim1 < $tim2)
> {
> echo
> "<TR><TD>".$myrow[$tim1]."</a><TD>".$myrow[$tim2]."</a><TD>".$
> myrow["labor_o
> rd_no"]."</a><TD>".$myrow["labor_wkyr"]."</a><TD>".$myrow["wor
> ks_orders_cust
> omer_id"]."</a><TD>".$myrow["works_orders_part_no"]."</a><TD>"
> .$myrow["works
> _orders_qty"]."</a><TD>".$myrow["labor_qty"]."</a><TD>".$myrow
> ["labor_time"]
> ."</a><TD>".$myrow["timea"];
> 
> Regards
> 
> Steve Dodkins
> 
> IMPORTANT NOTICE The information in this e-mail is 
> confidential and should
> only be read by those persons to whom it is addressed and is 
> not intended to
> be relied upon by any person without subsequent written 
> confirmation of its
> contents. ebm-ZIEHL (UK) Ltd. cannot accept any responsibility for the
> accuracy or completeness of this message as it has been 
> transmitted over a
> public network.   Furthermore, the content of this e-mail is 
> the personal
> view of the sender and does not represent the advice, views 
> or opinion of
> our company. Accordingly, our company disclaim all 
> responsibility and accept
> no liability (including in negligence) for the consequences 
> of any person
> acting, or refraining from acting, on such information prior 
> to the receipt
> by those persons of subsequent written confirmation. In 
> particular (but not
> by way of limitation) our company disclaims all 
> responsibility and accepts
> no liability for any e-mails which are defamatory, offensive, 
> racist or in
> any other way are in breach of any third party's rights, 
> including breach of
> confidence, privacy or other rights. If you have received this e-mail
> message in error, please notify me immediately by telephone. 
> Please also
> destroy and delete the message from your computer. Any form 
> of reproduction,
> dissemination, copying, disclosure, modification, distribution and/or
> publication of this e-mail message is strictly prohibited.  
> If you have
> received this E-mail in error, or suspect that the message 
> may have been
> intercepted or amended, please notify ebm-ZIEHL (UK) Ltd on +44(0)1245
> 468555.
> ebm-ZIEHL (UK) Ltd Chelmsford Business Park, Chelmsford, Essex CM2 5EZ
> 
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux