devlog101010 devlog101010 - 1 year ago 42
HTML Question

Hide div if database contains value

I want to check if a MySQL database contains a specific value. If it is true I want to hide a HTML

. Is this possible?

Can I hide elements with PHP, or what should I use to hide the div? Thanks!


Try something like this in your PHP file. I have included an example of an item that is always rendered, and something that is conditionally rendered.

<div id="userinfo">
    <?php // This is always rendered by the server ?>
    Username: <?php htmlentities($row['username']) ?>

    <?php // This is rendered by the server if the column is true ?>
    <?php if ($row['admin']): ?>
        <div class="admin">(admin)</div>
    <?php endif ?>