Ok, so I am making (attempting) to make a simple car racing league/pool
I have some of it started, but now I am st the point when I need to figure out the best structure for the DB before I go further.
What I have so far
// Report all PHP errors (see changelog)
error_reporting(E_ALL);
include_once('db_conn.php');
$sql = "SELECT * FROM `nascar_standings` ORDER BY driver ASC LIMIT 65";
$rs = mysql_query($sql);
$user = "frank";
$i = 0;
$sel_text = "";
$column = "</tr><tr>";
$sel_text .= "<form name='frmChk' action='testsel1.php' method='post'>";
while($row = mysql_fetch_assoc($rs)){
$label = $row['driver'];
$sel_text .= "<td><input type='checkbox' name='chks[]'> $label </td>";
if (++$i % 4 == 0)
{
$sel_text .= $column;
}
}
$sel_text .= "</tr><tr><td colspan =4 valign = center><input type='submit' value='Validate & Submit' name='validate' onclick='if(!checkCount()) return false;'></form></td></tr></table>";
$sel_text .= "<script language='javascript'>
function checkCount(){
var count=0;
var inputs=document.frmChk.getElementsByTagName('input');
for(var i=0; i<inputs.length-1; i++){
if(inputs[i].type == 'checkbox' && inputs[i].checked == true)
count++;
}
if(count != 7){
alert('You must select 7 Drivers');
return false;
}
return true;
}
</script>";
$tpl -> AssignArray(array('selteam' => $sel_text));
So, in the DB I pull all the drivers(approx 65) and print them to screen with checkboxes and have the user pick 7
Now, I guess I will need a new entry for each user with their 7 picked drivers.
Then each week, they will pick 4 of their 7 drivers, then those 4 drivers will earn whatever point for that week. plus a running tally for each week.
I am really stumped here on how to initially set up the DB
Any guidance on this would be awsome.
Thanx.