Parašė jadze· 2011 Lie. 4 17:07:16
#1
Sveiki visi. iškilo tokia bėda, man reikia, kad komandų profilį būtų rodomi komandų keitimai. Sistemą trade turiu čia kažkokią, jau maždaug prisitaikiau į komandų profilį, bet iškilo viena problema, niekaip nepagaunu kaip padaryt, kad rodytų žaidėjus koki išmainyti, dabar man rodo vietoj jų tiesiog (0), o panelėje visi mainai viską rodo gerai.
Foto kaip rodo profilį:
Foto kaip rodo "Visi mainai"
Foto iš
mysql:
Štai keitimai.php kodas kuris turi atsispindėti komandų profilyje.
<?php
require_once "../../maincore.php";
$where = $_GET['id'] ? $_GET['id'] : 0;
$where = isNum($where) ? $where : 0;
$query = dbquery("SELECT * FROM teams WHERE id = '$where'");
$i = 0;
while ($komandos = dbarray($query)) {
$i++;
$idd = $komandos['id'];
$namee = $komandos['name'];
$imagee = $komandos['image'];
$image = $komandos['logo'];
}
$qqq = dbquery("SELECT * FROM trades WHERE komanda1 = '$where' OR komanda2 = '$where' ORDER by time DESC");
echo "<table width='100%' bgcolor='#cccccc' cellpadding='0' cellspacing='1' align='center'>";
echo "
<tr>
<td align='center' class='tbl2'>Komanda:</td>
<td align='center' class='tbl2'>Žaidėjai 1:</td>
<td align='center' class='tbl2'>Žaidėjai 2:</td>
<td align='center' class='tbl2'>Komanda:</td>
<td align='center' class='tbl2'>Būsena:</td>
</tr>";
while ($q = dbarray($qqq)) {
$komanda1 = $q['komanda1'];
$komanda2 = $q['komanda2'];
$zaidejas11 = $q['zaidejas11'];
$zaidejas12 = $q['zaidejas12'];
$zaidejas13 = $q['zaidejas13'];
$zaidejas21 = $q['zaidejas21'];
$zaidejas22 = $q['zaidejas22'];
$zaidejas23 = $q['zaidejas23'];
$id = $q['id'];
$busena = $q['busena'];
$pirma = dbquery("SELECT name FROM teams where id='$komanda1'");
while ($q = dbarray($pirma)) {
$name1 = $q['name'];
}
$antra = dbquery("SELECT name FROM teams where id='$komanda2'");
while ($q = dbarray($antra)) {
$name2 = $q['name'];
}
$pl11 = dbquery("SELECT name FROM zaidejai where id='$zaidejas11'");
while ($q = dbarray($pl11)) {
$name11 = $q['name'];
}
$pl12 = dbquery("SELECT name FROM zaidejai where id='$zaidejas12'");
while ($q = dbarray($pl12)) {
$name12 = $q['name'];
}
$pl13 = dbquery("SELECT name FROM zaidejai where id='$zaidejas13'");
while ($q = dbarray($pl13)) {
$name13 = $q['name'];
}
$pl21 = dbquery("SELECT name FROM zaidejai where id='$zaidejas21'");
while ($q = dbarray($pl21)) {
$name21 = $q['name'];
}
$pl22 = dbquery("SELECT name FROM zaidejai where id='$zaidejas22'");
while ($q = dbarray($pl22)) {
$name22 = $q['name'];
}
$pl23 = dbquery("SELECT name FROM zaidejai where id='$zaidejas23'");
while ($q = dbarray($pl23)) {
$name23 = $q['name'];
}
$o11 = dbquery("SELECT Overall FROM zaidejai where id='$zaidejas11'");
while ($q = dbarray($o11)) {
$o11 = $q['Overall'];
}
$o12 = dbquery("SELECT Overall FROM zaidejai where id='$zaidejas12'");
while ($q = dbarray($o12)) {
$o12 = $q['Overall'];
}
$o13 = dbquery("SELECT Overall FROM zaidejai where id='$zaidejas13'");
while ($q = dbarray($o13)) {
$o13 = $q['Overall'];
}
$o21 = dbquery("SELECT Overall FROM zaidejai where id='$zaidejas21'");
while ($q = dbarray($o21)) {
$o21 = $q['Overall'];
}
$o22 = dbquery("SELECT Overall FROM zaidejai where id='$zaidejas22'");
while ($q = dbarray($o22)) {
$o22 = $q['Overall'];
}
$o23 = dbquery("SELECT Overall FROM zaidejai where id='$zaidejas23'");
while ($q = dbarray($o23)) {
$o23 = $q['Overall'];
}
echo "<tr>
<td class='tbl1' align='center'><a href='".BASEDIR."infusions/stats/komandos.php?id=$komanda1'><img src='".BASEDIR."images/logo/$name1.png' border='0' style='opacity:0.4;filter:alpha(opacity=40)' onmouseover='this.style.opacity=1;this.filters.alpha.opacity=100' onmouseout='this.style.opacity=0.4;this.filters.alpha.opacity=40' width='25'></a></td>
<td class='tbl1' align='center'><a href='".BASEDIR."infusions/stats/zaidejai.php?id=$zaidejas11'>$name11</a> ($o11)";
if ($zaidejas12) { echo "<br> <a href='".BASEDIR."infusions/stats/zaidejai.php?id=$zaidejas12'>$name12</a> ($o12)"; }
if ($zaidejas13) { echo "<br> <a href='".BASEDIR."infusions/stats/zaidejai.php?id=$zaidejas13'>$name13</a> ($o13)"; }
echo "</td>
<td class='tbl1' align='center'><a href='".BASEDIR."infusions/stats/zaidejai.php?id=$zaidejas21'>$name21</a> ($o21)";
if ($zaidejas22) { echo "<br> <a href='".BASEDIR."infusions/stats/zaidejai.php?id=$zaidejas22'>$name22</a> ($o22)"; }
if ($zaidejas23) { echo "<br> <a href='".BASEDIR."infusions/stats/zaidejai.php?id=$zaidejas23'>$name23</a> ($o23)"; }
echo "</td>
<td class='tbl1' align='center'><a href='".BASEDIR."infusions/stats/komandos.php?id=$komanda2'><img src='".BASEDIR."images/logo/$name2.png' border='0' style='opacity:0.4;filter:alpha(opacity=40)' onmouseover='this.style.opacity=1;this.filters.alpha.opacity=100' onmouseout='this.style.opacity=0.4;this.filters.alpha.opacity=40' width='25'></a></td>
<td class='tbl1' align='center'>";
if ($busena == 'Nepatvirtintas'){
$resultas = dbquery("SELECT * from teams WHERE id='$komanda2' AND treneris='".$userdata['user_name']."'");
if(dbrows($resultas)) {
if(isset($_GET['veiksmas'])){
$aOwvaQcasfltgeWivasdawofaAeTTT = stripinput($_GET['veiksmas']);
if ($aOwvaQcasfltgeWivasdawofaAeTTT == "Patvirtintas") {
$result = dbquery("UPDATE zaidejai SET team_id = '$komanda2' where id = '$zaidejas11'");
$result = dbquery("UPDATE zaidejai SET team_id = '$komanda2' where id = '$zaidejas12'");
$result = dbquery("UPDATE zaidejai SET team_id = '$komanda2' where id = '$zaidejas13'");
$result = dbquery("UPDATE zaidejai SET team_id = '$komanda1' where id = '$zaidejas21'");
$result = dbquery("UPDATE zaidejai SET team_id = '$komanda1' where id = '$zaidejas22'");
$result = dbquery("UPDATE zaidejai SET team_id = '$komanda1' where id = '$zaidejas23'");
}
$uzklausa = mysql_query("UPDATE keitimai SET busena='$aOwvaQcasfltgeWivasdawofaAeTTT' WHERE id='$id'");
if($uzklausa){
fallback("keitimai.php");
}
}
echo "<a href='".BASEDIR."keitimai.php?veiksmas=Patvirtintas'>Patvirtinti</a>/<a href='".BASEDIR."keitimai.php?veiksmas=Atmestas'>Atmesti</a> | ";
}
echo "<b>$busena";
} else {
echo "<b>$busena";
}
echo "</td></tr>";
}
echo "</table>";
?>
Kodas "visi mainai.php"
<?
require_once "../../maincore.php";
require_once BASEDIR."subheader.php";
require_once BASEDIR."side_left.php";
opentable("Visi Mainai");
$result = dbquery("SELECT * FROM trades WHERE busena >='1' ORDER BY time DESC");
echo "<table width='100%' class='tbl-border' border='0'>\n";
if (dbrows($result)) {
echo "<tr>
<td class='tbl2' align='center'><b>Pateikta</b></td>
<td class='tbl2' align='center'><b>Pasiūlymas pateiktas</b></td>
<td class='tbl2' align='center'><b>Siūlomi žaidėjai</b></td>
<td class='tbl2' align='center'><b>Pageidaujami žaidėjai</b></td>
<td class='tbl2' align='center'><b>Pasiulyma gavo</b></td>
<td class='tbl2' align='center'><b>Statusas</b></td>";
//if(iADMIN) { echo "<td class='tbl2' align='center'><b>Tvirtinti/Atmesti</b></td>\n"; }
echo "</tr>\n";
while ($data = dbarray($result)) {
$f = dbarray(dbquery("SELECT id, name FROM teams WHERE id= '".$data['komanda1']."'"));
$s = dbarray(dbquery("SELECT id, name FROM teams WHERE id= '".$data['komanda2']."'"));
$a1 = unserialize($data['keitimas1']);
$a2 = unserialize($data['keitimas2']);
$busena='';
if ($data['busena'] == 1) {
$busena = "Laukia";
}
if ($data['busena'] == 2) {
$busena = "Patvirtinta";
}
if ($data['busena'] == 3) {
$busena = "Nepatvirtinta";
}
echo "<tr>
<td class='tbl1' align='center'>".date("Y-m-d, H:i:s", $data['time'])."</td>
<td class='tbl1' align='center'><a href='".INFUSIONS."stats/komandos.php?id=".$f['id']
."' target='_self'>".$f['name']."</a></td>
<td class='tbl1' align='center'>";
foreach ($a1 as $m1) {
echo $m1."<br>";
}
echo "</td>
<td class='tbl1' align='center'>";
foreach ($a2 as $m2) {
echo $m2."<br>";
}
echo "</td>
<td class='tbl1' align='center'><a href='".INFUSIONS."stats/komandos.php?id=".$s['id']
."' target='_self'>".$s['name']."</a></td>
<td class='tbl1' align='center'>".$busena."</td>
</tr>\n";
}
} else {
echo "<tr><td>Mainų nėra</td></tr>";
}
echo "</table>\n";
closetable();
require_once BASEDIR."side_right.php";
require_once BASEDIR."footer.php";
?>
Tikiuosi supratot ko noriu iš jūsų. Pats nesugebu persidaryti kodo, gal jūs perdarysite keitimai.php naudodamiesi pavyzdžiu kuris yra visi mainai.php
Redagavo jadze· 2011 Lie. 4 17:07:34