RE: [PHP] Delimiter WITHOUT lots of IF's
| From: | Cesar Aracena | Date: | Tue, 19 Aug 2003 17:54:36 +0000 |
| Subject: | RE: [PHP] Delimiter WITHOUT lots of IF's | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-160041@lists.php.net to get a copy of this message | ||
Ok, That's logical, but the thing is that even $x and $n are empty, as
if the result would give a hole bunch of zeros (but it isn't).
Could there be an error in the query or somewhere around that we are all
missing?
Thanks,
Cesar
> function cart_cdqty()
> {
>
> $query = "SELECT SUM(sess_itemsize) AS total_size
> FROM sessions
> WHERE sess_id = ".$_COOKIE['SID']."";
>
> $result = mysql_query($query);
>
> if(!$row = mysql_fetch_array($result))
> {
> return false;
> } else {
> $n = $row['total_size'];
> $x = ceil( $n / 690.0 );
>
> $cart_cdqty = array(
> 'quantity' => $x,
> 'total_size' => $n
> );
>
> return $cart_cdqty;
> }
>
> }