Автор: onwars
Дата сообщения: 13.04.2010 19:08
вот весь код. Он служит для отбора 16 команд и создания матчей первого тура на 8игр.
Код:
$q2 = mysql_query("select `name_team` from `m_start` where `chemp`='".$k['name']."' LIMIT 16; ");
while( $x2 = mysql_fetch_row($q2))
{ $w2[] = $x2[0] ; }
shuffle($w2);
//////////////
$q = mysql_result(mysql_query("select `id` from `m_team` where `name`='".$w2[0]."'"),0);
$q1 = mysql_result(mysql_query("select `id` from `m_team` where `name`='".$w2[1]."'"),0);
$q2 = mysql_result(mysql_query("select `id` from `m_team` where `name`='".$w2[2]."'"),0);
$q3 = mysql_result(mysql_query("select `id` from `m_team` where `name`='".$w2[3]."'"),0);
$q4 = mysql_result(mysql_query("select `id` from `m_team` where `name`='".$w2[4]."'"),0);
$q5 = mysql_result(mysql_query("select `id` from `m_team` where `name`='".$w2[5]."'"),0);
$q6 = mysql_result(mysql_query("select `id` from `m_team` where `name`='".$w2[6]."'"),0);
$q7 = mysql_result(mysql_query("select `id` from `m_team` where `name`='".$w2[7]."'"),0);
$q8 = mysql_result(mysql_query("select `id` from `m_team` where `name`='".$w2[8]."'"),0);
$q9 = mysql_result(mysql_query("select `id` from `m_team` where `name`='".$w2[9]."'"),0);
$q10 = mysql_result(mysql_query("select `id` from `m_team` where `name`='".$w2[10]."'"),0);
$q11 = mysql_result(mysql_query("select `id` from `m_team` where `name`='".$w2[11]."'"),0);
$q12 = mysql_result(mysql_query("select `id` from `m_team` where `name`='".$w2[12]."'"),0);
$q13 = mysql_result(mysql_query("select `id` from `m_team` where `name`='".$w2[13]."'"),0);
$q14 = mysql_result(mysql_query("select `id` from `m_team` where `name`='".$w2[14]."'"),0);
$q15 = mysql_result(mysql_query("select `id` from `m_team` where `name`='".$w2[15]."'"),0);
////////////
mysql_query("INSERT INTO `m_cl` set `time`='".$realtime."', `tur`='1', `chemp`='".$k['name']."',`id_team1`='".$q."',`name_team1`='".$w2[0]."',`id_team2`='".$q1."',`name_team2`='".$w2[1]."' ;");
mysql_query("INSERT INTO `m_cl` set `time`='".$realtime."', `tur`='1', `chemp`='".$k['name']."',`id_team1`='".$q2."',`name_team1`='".$w2[2]."',`id_team2`='".$q3."',`name_team2`='".$w2[3]."' ;");
mysql_query("INSERT INTO `m_cl` set `time`='".$realtime."', `tur`='1', `chemp`='".$k['name']."',`id_team1`='".$q4."',`name_team1`='".$w2[4]."',`id_team2`='".$q5."',`name_team2`='".$w2[5]."' ;");
mysql_query("INSERT INTO `m_cl` set `time`='".$realtime."', `tur`='1', `chemp`='".$k['name']."',`id_team1`='".$q6."',`name_team1`='".$w2[6]."',`id_team2`='".$q7."',`name_team2`='".$w2[7]."' ;");
mysql_query("INSERT INTO `m_cl` set `time`='".$realtime."', `tur`='1', `chemp`='".$k['name']."',`id_team1`='".$q8."',`name_team1`='".$w2[8]."',`id_team2`='".$q9."',`name_team2`='".$w2[9]."' ;");
mysql_query("INSERT INTO `m_cl` set `time`='".$realtime."', `tur`='1', `chemp`='".$k['name']."',`id_team1`='".$q10."',`name_team1`='".$w2[10]."',`id_team2`='".$q11."',`name_team2`='".$w2[11]."' ;");
mysql_query("INSERT INTO `m_cl` set `time`='".$realtime."', `tur`='1', `chemp`='".$k['name']."',`id_team1`='".$q12."',`name_team1`='".$w2[12]."',`id_team2`='".$q13."',`name_team2`='".$w2[13]."' ;");
mysql_query("INSERT INTO `m_cl` set `time`='".$realtime."', `tur`='1', `chemp`='".$k['name']."',`id_team1`='".$q14."',`name_team1`='".$w2[14]."',`id_team2`='".$q15."',`name_team2`='".$w2[15]."' ;");