Skip to content Skip to sidebar Skip to footer

Limit Registration To 4 People On Form Sign Up

I have some code, seen below. I would like some help changing this into normal PHP statement and not object orientated. Not very good with PHP still learning.

Solution 1:

try this you can use an alias for COUNT(*)

<?php        
    $connection=mysqli_connect("host", "username", "password", "database");
    $sql="SELECT COUNT(*) as cnt from database_users";
    $res = mysqli_query($connection, $sql);
    $users = $result->fetch_assoc(); 
    if ($users['cnt'] < 4) {
?>

    // html goes here, outside of the php tags

<?php
    } else {

        echo "Sorry, you have reached the user account limit.";

    }
?>

Post a Comment for "Limit Registration To 4 People On Form Sign Up"