Witajcie otoz chce stworzyc wlasne teams.php i napisalem taki kod:
Kod php:
<?php
include('baza.php');
include('gora.php');
$teams= mysql_fetch_array(mysql_query("SELECT team, kasa FROM users WHERE user='$user'"));
if($teams[0]>0){
$kasa = $teams[kasa];
}
else{
echo '<form method=post action=teams.php>
Tag: <input type=text name=tag><br>
Nazwa:<input type=text name=addname><br>
<br>
<input type=submit value=Dodaj>
</form>';
if (isSet($_POST['dodaj']) ) {
if ($kasa> 3000){
$addname = addslashes($_POST['addname']);
$tag = addslashes($_POST['tag']);
$tn = mysql_fetch_array(mysql_query("SELECT id FROM teams WHERE name='".$addname."'"));
$tt = mysql_fetch_array(mysql_query("SELECT id FROM teams WHERE tag='".$tag."'"));
if($tn == 0 && $tt == 0){
$query = mysql_query("INSERT INTO teams (name, tag, cheif) values('$tag','$addname','$user')") or die("Nie mogę dodać.");
$idt = mysql_fetch_array(mysql_query("SELECT id FROM teams WHERE chief='$user'"));
$kasa1 = $kasa - 2000;
mysql_query("UPDATE users SET team='".$idt[0]."', kasa='$kasa1' WHERE user='$user'");
echo 'Team dodany .';
}
else{
echo 'Team taki juz istnieje.';
}
}
else{
echo 'Masz za malo kasy.';
}
}
}
include('dol.php');
?>
Co w nim jest nie tak?? Poniewaz gdy wpisze nazwe i tag to nic sie nie dzieje czemu??
Zakładki