I'm not sure if this is more suited for PHP or for both PHP/MySQL since their both involved, but can it pleased be moved if its the wrong place
What i'm trying to do is a staff pay system where the staff member will go to a certain page and will get their items
Staff pay resets every Saturday. The member of staff can get the pay any day of the week.
When the staff member gets the pay, its entered into a database.
CREATE TABLE `staffpay` (
`ID` int(11) NOT NULL auto_increment,
`name` text NOT NULL,
`date` date NOT NULL,
PRIMARY KEY (`ID`)
) TYPE=MyISAM AUTO_INCREMENT=1 ;
Name is the staff members name and date is the date they received the pay.
What i'm looking to do is make it so that they can only gain the staff pay once a week, as at the moment they can go every day. This is where i need a push in the right direction, as i'm unsure what the best way of going about this is
This is the code i have currently
<?php
include ('games/insert.php');
$sql = mysql_query("SELECT * FROM `staffpay` WHERE `name` = '".$_COOKIE['dwtcg']['u']."'") or die(mysql_error()); $result = mysql_num_rows($sql);
if ($result != 0) {
die("<p>Already Got staff pay this week</p></div></div></body></html>");
} else {
echo "<br/>All thats below have been added<br />";
normal(); normal(); normal(); normal(); normal(); special();
mysql_query("INSERT INTO `game` VALUES (NULL, 'movie', '".$_COOKIE['dwtcg']['u']."', '" . $_SESSION['id'] . "')") or die(mysql_error());
}?>
So i either need to change the sql so that it checks that i haven't recieve pay since the saturday that had just gone, or some php that does the same