
Untitled
By: a guest on
May 2nd, 2012 | syntax:
None | size: 0.55 KB | hits: 13 | expires: Never
PHP / MYSQL random football timetable
<?php
mysql_query("INSERT INTO timetable (id, team1, team2, date, time) VALUES ('','Blue','Red','2011-02-06','18.00')")
?>
<?php
$teams = array('Red Team', 'Blue Team', 'Yellow Team', 'Green Team');
foreach($teams as $team_one) {
foreach($teams as $team_two) {
mysql_query("INSERT INTO timetable (team1, team2) VALUES ('$team_one', '$team_two')");
}
}
?>
mysql_query("INSERT INTO timetable (team1, team2) VALUES ('".mysql_real_escape_string($team_one)."', '".mysql_real_escape_string($team_two)."')");