Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Pridėti taškus.

Parašė 1941· 2011 Spa. 4 15:10:29
#1

Sveiki,

Turiu F1 turnyrą. Turnyrinės lentelės yra iš Fifos stats perdarytos, kaip ir visi kiti failai. Man padarė, kad pridėtum taškus ir pačios iškart atsinaujintų (Nereiktų taškų surašinėt per mysql) (Perdarė iš kažkokio modo, kad šiaip pridėtum nariui taškus), bet dabar kaip pridedi taškus jie prisideda tik mažiausiai taškų turinčiam dalyviui, o ne kurį pasirenki.

Kodas :


<?php
require_once '../../maincore.php';
require_once '../../subheader.php';
require_once '../../side_left.php';
 
 
// Check if locale file is available matching the current site locale setting.
if (file_exists(INFUSIONS."stats/locale/".$settings['locale'].".php")) {
	// Load the locale file matching the current site locale setting.
	include INFUSIONS."stats/locale/".$settings['locale'].".php";
} else {
	// Load the infusion's default locale file.
	include INFUSIONS."stats/locale/Lt.php";
}
if (iADMIN && (iUSER_RIGHTS != "" || iUSER_RIGHTS != "C")) {
opentable("".$locale['t_title']."");
 
 
	echo "<form method='post' action='".$_SERVER['PHP_SELF']."'><select name='id' class='textbox'>";
   $result = dbquery("SELECT * FROM zaidejai ORDER BY goals DESC");
   if (dbrows($result) != 0) {
   while ($data = dbarray($result)) {
	$id = $data['id'];
	$name = $data['name'];
        echo "<option value=\"".$id."\" name='id' class='textbox'>".$name."</option>";
	}
	echo "</select>
	<input type='hidden' value='".$_POST['id']."' name='user_id' />
	<input type='text' name='goals' value='".$data['goals']."' class='textbox' />
	<input type='submit' name='prideti' value='".$locale['tp']."' class='button' />
	<input type='submit' name='atimti' value='".$locale['pt']."' class='button' /></form>";
   }
 
   	}
 
   if(isset($_POST['prideti'])) {
   $result = dbquery("UPDATE zaidejai SET goals=goals+'".$_POST['goals']."' WHERE id = '".$id."'");
	}
 
	   if(isset($_POST['atimti'])) {
   $result = dbquery("UPDATE zaidejai SET goals=goals+-'".$_POST['goals']."' WHERE id = '".$id."'");
	}
 
closetable();
 
require_once '../../side_right.php';
require_once '../../footer.php';
 
?>


P.S Nekreipkit dėmesio į tuos order by goals... Nes sakau daryta iš fifa statistikos ir nepakeisti tie goals, zaidejai ir tt..

Redagavo 1941· 2011 Spa. 4 15:10:54

Parašė Ponas24· 2011 Spa. 4 15:10:11
#2


<?php
 
require_once '../../maincore.php';
 
require_once '../../subheader.php';
 
require_once '../../side_left.php';
 
 
 
 
 
// Check if locale file is available matching the current site locale setting.
 
if (file_exists(INFUSIONS."stats/locale/".$settings['locale'].".php")) {
 
	// Load the locale file matching the current site locale setting.
 
	include INFUSIONS."stats/locale/".$settings['locale'].".php";
 
} else {
 
	// Load the infusion's default locale file.
 
	include INFUSIONS."stats/locale/Lt.php";
 
}
 
if (iADMIN && (iUSER_RIGHTS != "" || iUSER_RIGHTS != "C")) {
 
opentable("".$locale['t_title']."");
 
 
 
 
 
	echo "<form method='post' action='".$_SERVER['PHP_SELF']."'><select name='id' class='textbox'>";
 
   $result = dbquery("SELECT * FROM zaidejai ORDER BY goals DESC");
 
   if (dbrows($result) != 0) {
 
   while ($data = dbarray($result)) {
 
	$id = $data['id'];
 
	$name = $data['name'];
 
        echo "<option value=\"".$id."\" name='id' class='textbox'>".$name."</option>";
 
	}
 
	echo "</select>
 
	<input type='hidden' value='".$_POST['id']."' name='user_id' />
 
	<input type='text' name='goals' value='".$data['goals']."' class='textbox' />
 
	<input type='submit' name='prideti' value='".$locale['tp']."' class='button' />
 
	<input type='submit' name='atimti' value='".$locale['pt']."' class='button' /></form>";
 
   }
 
 
 
   	}
 
 
 
   if(isset($_POST['prideti'])) {
 
   $result = dbquery("UPDATE zaidejai SET goals=goals+'".$_POST['goals']."' WHERE id = '".$_POST['id']."'");
 
	}
 
 
 
	   if(isset($_POST['atimti'])) {
 
   $result = dbquery("UPDATE zaidejai SET goals=goals-'".$_POST['goals']."' WHERE id = '".$_POST['id']."'");
 
	}
 
 
 
closetable();
 
 
 
require_once '../../side_right.php';
 
require_once '../../footer.php';
 
 
 
?>


Bandyk

Parašė bruzgis· 2011 Spa. 4 16:10:37
#3


<?php
require_once '../../maincore.php';
require_once BASEDIR.'subheader.php';
require_once BASEDIR.'side_left.php';
 
if (!iADMIN || iUSER_RIGHTS == "" || iUSER_RIGHTS == "C")  redirect(BASEDIR."index.php");
 
if (file_exists(INFUSIONS."stats/locale/".$settings['locale'].".php"))
	include INFUSIONS."stats/locale/".$settings['locale'].".php";
else 
	include INFUSIONS."stats/locale/Lt.php"; 
 
 
opentable("".$locale['t_title']."");
 
	$result = dbquery("SELECT * FROM zaidejai ORDER BY goals DESC");
 
    if (dbrows($result) != 0) 
	{
			echo "<form method='post' action='".FUSION_SELF."'><select name='id' class='textbox'>";
			while ($data = dbarray($result))
			{
				print "<option value='".$data['id']."'>".$data['name']."</option>";
			}
			echo "</select>
			<input type='hidden' value='".$_POST['id']."' name='user_id' />
			<input type='text' name='goals' value='".$data['goals']."' class='textbox' />
			<input type='submit' name='prideti' value='".$locale['tp']."' class='button' />
			<input type='submit' name='atimti' value='".$locale['pt']."' class='button' />
			</form>";
   } 
   else 
   {
	print "Nera irasu";
   } 
 
   if(isset($_POST['prideti'])) dbquery("UPDATE zaidejai SET goals=goals+".$_POST['goals']." WHERE id = ".$_POST['id']);
   if(isset($_POST['atimti'])) dbquery("UPDATE zaidejai SET goals=goals-".$_POST['goals']." WHERE id = ".$_POST['id']); 
 
closetable();
 
require_once BASEDIR.'side_right.php';
require_once BASEDIR.'footer.php';
?>

Parašė marqs· 2011 Spa. 8 20:10:15
#4


<?php
 
require_once '../../maincore.php';
 
require_once '../../subheader.php';
 
require_once '../../side_left.php';
 
 
 
 
 
// Check if locale file is available matching the current site locale setting.
 
if (file_exists(INFUSIONS."stats/locale/".$settings['locale'].".php")) {
 
	// Load the locale file matching the current site locale setting.
 
	include INFUSIONS."stats/locale/".$settings['locale'].".php";
 
} else {
 
	// Load the infusion's default locale file.
 
	include INFUSIONS."stats/locale/Lt.php";
 
}
 
if (iADMIN && (iUSER_RIGHTS != "" || iUSER_RIGHTS != "C")) {
 
opentable($locale['t_title']);
 
 
 
 
 
   echo "<form method='post' action='".$_SERVER['PHP_SELF']."'><select name='id' class='textbox'>";
 
   $result = dbquery("SELECT * FROM zaidejai ORDER BY goals DESC");
 
   if (dbrows($result) != 0) {
   while ($data = dbarray($result)) {
	$id = $data['id'];
	$name = $data['name'];
        echo "<option value='$id' name='id' class='textbox'>".$name."</option>";
	}
 
	echo "</select>
 
	<input type='hidden' value='".$_POST['id']."' name='user_id' />
 
	<input type='text' name='goals' value='".$data['goals']."' class='textbox' />
 
	<input type='submit' name='prideti' value='".$locale['tp']."' class='button' />
 
	<input type='submit' name='atimti' value='".$locale['pt']."' class='button' /></form>";
 
   }
 
 
}
 
 
 
   if(isset($_POST['prideti'])) { $result = dbquery("UPDATE zaidejai SET goals = goals + '".$_POST['goals']."' WHERE id = '".$_POST['user_id']."'"); }
   if(isset($_POST['atimti'])) { $result = dbquery("UPDATE zaidejai SET goals = goals - '".$_POST['goals']."' WHERE id = '".$_POST['user_id']."'"); }
 
 
 
closetable();
 
 
 
require_once '../../side_right.php';
 
require_once '../../footer.php';
 
 
 
?>