cafte, mam takyto system, ide mi o to ze neviem ako dorobit to ze ked je skore timu a vacsie ako b tak sa A prirataju dvabody ak je vacsie b tak b ak su rovnake tak po jednom, PROSIM POMOZTE MI
<?php
class MyDB{
public $connect;
private $databaza;
function __construct(){
$this->connect = mysql_connect("localhost", "root", "");
$this->databaza = mysql_select_db("vysledky");
}
}
?>
<?php
class Vystup{
private $sql1;
private $sql2;
private $vystup1;
private $vystup2;
function Vystup_X_vs_Y(){
$this->sql1 = mysql_query("SELECT * FROM zapasy WHERE kolo='$_GET[kolo]' ORDER BY id DESC");
while($this->vystup1 = mysql_fetch_array($this->sql1)){
echo htmlspecialchars($this->vystup1['tim_a']);
echo " : ";
echo htmlspecialchars($this->vystup1['tim_b']);
echo " ";
echo htmlspecialchars($this->vystup1['skore_tim_a']);
echo " : ";
echo htmlspecialchars($this->vystup1['skore_tim_b']);
echo "<br><br>";
}
}
function Tabulka_vystup_bodovanie(){
$this->sql2 = mysql_query("SELECT * FROM tabulka ORDER BY body DESC");
while($this->vystup2 = mysql_fetch_array($this->sql2)){
echo " " . htmlspecialchars($this->vystup2['tim']);
echo " " . htmlspecialchars($this->vystup2['body']);
echo "<br>";
}
}
}
?>
<?php
include('MyDB.class.php');
include('Vystup.class.php');
$MyDB = new MyDB();
$Vystup = new Vystup();
$Vystup -> Vystup_X_vs_Y();
?>
<a href="vysledky.php?kolo=1">1. KOLO</a>
<a href="vysledky.php?kolo=2">2. KOLO</a>
<a href="vysledky.php?kolo=3">3. KOLO</a>
<a href="tabulka.php">
<?php
include('MyDB.class.php');
include('Vystup.class.php');
$MyDB = new MyDB();
$tabulka = new Vystup();
$tabulka->Tabulka_vystup_bodovanie();
?>
TU!!!
<?php
include('MyDB.class.php');
$MyDB = new MyDB();
$tim_a = $_POST['tim_a'];
$tim_b = $_POST['tim_b'];
$body_a = $_POST['body_a'];
$body_b = $_POST['body_b'];
$kolo = $_POST['kolo'];
$tim_a_trim = trim($tim_a);
$tim_b_trim = trim($tim_b);
if(!empty($tim_a_trim) and $tim_b_trim){
$insert= mysql_query("INSERT INTO zapasy(tim_a, tim_b, skore_tim_a, skore_tim_b, kolo) VALUES('".addslashes($tim_a)."',
'".addslashes($tim_b)."',
'$body_a',
'$body_b',
'$kolo')");
echo htmlspecialchars("INSERT INTO vysledky(tim_a, tim_b, skore_tim_a, skore_tim_b) VALUES('".addslashes($tim_a)."',
'".addslashes($tim_b)."',
'$body_a',
'$body_b')");
if($insert){echo "OK";
/*
if($body_a < $body_b){
$select = mysql_query("SELECT * FROM tabulka WHERE tim='$tim'");
while($upni = mysql_fetch_array($select)){
$b=$upni['body'] + 2;
mysql_query("UPDATE tabulka SET body='$b' WHERE tim='$upni[tim]'");
echo htmlspecialchars("UPDATE tabulka SET body='$b' WHERE tim='$upni[tim]'");}*/
}
}
}
?>
<form method="POST">
Tim A:<input type="text" name="tim_a">
Tim B:<input type="text" name="tim_b">
Body timu A:<input type="text" name="body_a">
Body timu B:<input type="text" name="body_b">
Cislo KOLA: <input type="text" name="kolo">
<input type="submit">
</form>