Re: Table shows even when if () is false

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

 



On 8/22/07, Dan Shirah <mrsquash2@xxxxxxxxx> wrote:
> From my understanding, if $result_deferred_comments is empty, than none of
> the code below the if should be executed, correct?
>
> The actualy rows/columns that would contain the data do not appear, but I am
> still seeing the "DEFERRED PAYMENT REQUEST COMMENTS" table. Is the only way
> to block out EVERYTHING from being displayed if $result_deferred_comments is
> empty to use " " around all of the HTML and not exit out of the PHP tags?
> Or am I doing something else wrong?
>
> Or, is it a problem with (!empty())?  Since the value is an array, will it
> never be parsed as empty even if there is no data retrieved?
>
> Below is my code:
>
> <?php
> $credit_card_id = $_GET['credit_card_id'];
>
> $deferred_comments= "SELECT * FROM comments WHERE credit_card_id =
> '$credit_card_id' AND request_type = 'D'";
> $result_deferred_comments = mssql_query($deferred_comments) or
> die(mssql_error());
[snip!]

    That's an SQL result resource identifier that's being returned,
which is why it won't work.  Even if the query would return zero rows
(an empty result set) the query identifier is still returned to PHP.

-- 
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

Hey, PHP-General list....
50% off for life on web hosting plans $10/mo. or more at
http://www.pilotpig.net/.
Use the coupon code phpgeneralaug07
Register domains for about $0.01 more than what it costs me at
http://domains.pilotpig.net/.

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux