We are starting to migrate from ColdFusion to PHP and have to re-learn everything
Record count
Moderator: General Moderators
Record count
I made an even sign-up form using MySQL database. Can anyone help me with PHP code so when someone visits the page, it will check the database to see if 20 people have registered. If there has been 20 registrations, it won't show the form. If there haven't been 20 registrations it will show the form.
We are starting to migrate from ColdFusion to PHP and have to re-learn everything
We are starting to migrate from ColdFusion to PHP and have to re-learn everything
Code: Select all
$sql=mysql_query("SELECT DISTINCT COUNT(*) FROM users") OR DIE (mysql_error());
$num=mysql_num_rows($sql);
if ($num >=20){
echo "20 Users Registered";
}else{
show_form();
}Happy Valentines Day!
Code: Select all
$result=mysql_query("SELECT COUNT(*) FROM users") or die (mysql_error());
$num=mysql_result($result,0,0);
mysql_free_result($result);
if ($num >=20){
echo "20 Users Registered";
}else{
show_form();
}