Is there a way that I can automate the below?
The max I will need is $d20.
if ($d1 != ""){
mysql_query ("INSERT INTO GR (playerid, gameid) VALUES ('$d1' ,'$gameid')");
}
if ($d2 != ""){
mysql_query ("INSERT INTO GR (playerid, gameid) VALUES ('$d2' ,'$gameid')");
}
if ($d3 != ""){
mysql_query ("INSERT INTO GR (playerid, gameid) VALUES ('$d3' ,'$gameid')");
}
if ($d4 != ""){
mysql_query ("INSERT INTO GR (playerid, gameid) VALUES ('$d4' ,'$gameid')");
}
Also, I have an unknown amount of fields that could be added to this database. I am using check boxes. The only way I found to automate this was to have a variable be the text box name and have it +1 every new row. Thus I get d1 d2 d3 d4 etc. Is there a better way?
Thanks.