Wordpress If Statement Assistance

Discussion in 'PHP' started by aaron_nimocks, Feb 12, 2012.

Thread Status:
Not open for further replies.
  1. #1
    No idea why I cant get this to work.

    <table border="0" bordercolor="#FFCC00" style="background-color:#FFFFCC" width="100%" cellpadding="3" cellspacing="3">
        <tr>
            <td>Ticket Date</td>
            <td>Ticket Number</td>
            <td>Material</td>
            <td>Net Weight</td>
            <td>Price</td>
            <td>Paid</td>
        </tr>
    
        <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
    <? if ( the_field('paid') == 1 ) {
    echo "YES";
    } ?>
    
        <tr>
            <td><?php the_field('date'); ?></td>
            <td><?php the_title(); ?></td>
            <td><?php the_field('material'); ?></td>
            <td><?php the_field('weight'); ?></td>
            <td><?php the_field('price'); ?></td>
            <td><?php the_field('paid'); ?></td>
        </tr>
        <?php endwhile; else: ?>
            <p><?php _e('No posts by this author.'); ?></p>
    
        <?php endif; ?>
    </table>
    PHP:
    Here is a table and I only want to show the result if the_field('paid') is = 1. Now when I return the results I have 2 results. The first one is 1 and the other is NULL. This is a checkbox.

    No matter what I do thought I can't get a statement for if that is set. Also it ECHOs the 1 result for some odd reason in my if statement as you can see on http://aaronnimocks.com/basicmetals/open-tickets

    Any help is appreciated!
     
    aaron_nimocks, Feb 12, 2012 IP
Thread Status:
Not open for further replies.