Vote once with Status: ON / OFF feature

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Vote once with Status: ON / OFF feature

Post by social_experiment »

You don't mention where you placed the code; here is where i would place it

Code: Select all

<?php
 // 'id' should be some unique key, i use the primary key of the table usually.
 $countSql = "SELECT COUNT(id) FROM table";
 $countQry = mysql_query($countSql);
 $countAry = mysql_fetch_array($countQry);
 $rows = $countAry[0];

 if ($rows == 0) {
    $title = 'There are no song on the list.<br/>Please wait the current DJ to approve your Song Request.<br/>Thank you!';
    echo $title;
 }
 else {
   // the first block of code pasted will go inside the else statement
 }
?>
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply