Просмотр поста

.
xames10
$h=mysql_query("select * from fman_matches where id=$id;");
$fm=mysql_fetch_array($h);

$g = @mysql_query("select * from `r_cupgame` where id_chemp = '" . $id . "' LIMIT 1;");
$game = @mysql_fetch_array($g);
$q1 = @mysql_query("select * from `fman_clubs` where id='" . $game[id_team1] . "' LIMIT 1;");
$count1 = mysql_num_rows($q1);
$arr1 = @mysql_fetch_array($q1);

$q2 = @mysql_query("select * from `fman_clubs` where id='" . $game[id_team2] . "' LIMIT 1;");
$count2 = mysql_num_rows($q2);
$arr2 = @mysql_fetch_array($q2);
$rezult[0]=$sc1;
$rezult[1]=$sc2;
$lastid = mysql_insert_id();
$h=mysql_query("select * from fman_matches where id=$id;");
$fm=mysql_fetch_array($h);
///////////////////////////////////////////////////////////////////
    //////////////////           ПЕНАЛЬТИ          //////////////////////////
    ///////////////////////////////////////////////////////////////////

    if ($rezult[0] == $rezult[1])
    {
    $input = array ("5:3", "5:4", "4:2", "4:3", "3:2", "3:5", "4:5", "2:4", "3:4", "2:3");
    $rand_keys = array_rand ($input);

    $penult = explode(":",$input[$rand_keys]);

    $pen1 = $penult[0];
    $pen2 = $penult[1];
    }
if ($fm[turnir]=='1')
			{
if ($pen1 > $pen2) {	
$text='Asosiy va qo`shimcha vaqt '.$sc1.'-'.$sc2.'hisobi bilan yakunlandi. G`olib penaltilar seriyasida aniqlanadi. Uzoq kurashdan so`ng '.$pen1.'-'.$pen2.' hisobini <b>'.$arr1[name_team1].'</b> klubi saqlab qoldi!';
} else {
$text='Asosiy va qo`shimcha vaqt '.$sc1.'-'.$sc2.'hisobi bilan yakunlandi. G`olib penaltilar seriyasida aniqlanadi. Uzoq kurashdan so`ng '.$pen1.'-'.$pen2.' hisobini <b>'.$arr2[name_team2].'</b> klubi saqlab qoldi!';	
}
			} else {
$x1=rand(3,4);
$x2=rand(1,2);
if($x2==1)$ta=$t1;
if($x2==2)$ta=$t2;
$text='Asosiy va qo`shimcha vaqt '.$sc1.'-'.$sc2.'hisobi bilan yakunlandi. G`olib penaltilar seriyasida aniqlanadi. Uzoq kurashdan so`ng 5-'.$x1.' hisobini <b>'.$ta[name].'</b> klubi saqlab qoldi!';	
				}

if ($fm[turnir]=='1')
{	mysql_query("update `r_cupgame` set `rez1`='".$rezult[0]."',`rez2`='".$rezult[1]."', `pen1`='".$pen1."',`pen2`='".$pen2."', `id_report`='".$id."' where id='" . $game[id_match] . "' LIMIT 1;");
}


этот код правильно?