jldavis76
jldavis76

Reputation: 822

Embedded PHP if statement not working correctly

There's probably a simple reason that I'm overlooking, but my second if statement, the one with the condition of sizeof($duplicate) > 0, is not functioning properly. The block of html is still being displayed, despite the fact that I have verified that the size of $duplicate is in fact 0, and no list is being displayed under the paragraph tags. Am I missing something?

<html>
<head>
</head>
<body>
    <?php echo (sizeof($duplicate)); ?>
    <?php if(sizeof($not_exist > 0)) : ?>
        <p>The following companies were not updated because their Company Name did not exist in database: </p>
        <ul>
            <?php foreach($not_exist as $entry) {
                echo "<li>Company Name: " . $entry . "</li>";
            }
            ?>
        </ul>
    <?php endif; ?>
    <?php if(sizeof($duplicate > 0)) : ?>
        <p>The following companies had more than 1 entry under the same Company Name in database:</p>
        <ul>
            <?php foreach($duplicate as $entry) {
                echo "<li>Company Name: " . $entry . "</li>";
            }
            ?>
        </ul>
    <?php endif; ?>
    <?php if(sizeof($failed > 0)) : ?>
        <p>The following companies were not updated because the new Display Name already exists in QuickBooks:</p>
        <ul>
            <?php foreach($failed as $entry) {
                echo "<li>Company Name: " . $entry . "</li>";
            }
            ?>
        </ul>
    <?php endif; ?>
</body>

Thanks!

Upvotes: 0

Views: 48

Answers (1)

Mic Jaw
Mic Jaw

Reputation: 366

<?php if(sizeof($duplicate )>0) : ?>

Upvotes: 3

Related Questions