Lamez Posted March 28, 2009 Share Posted March 28, 2009 My action script that adds points to the users, and updates the database is not doing any of the mysql querys, it has work times and times before, but not now for some reason. It does redirect, but it does not echo anything out. I have no idea why. Here is the code: <?php ob_start(); $path = "../../"; $title = "Update Winners"; $u_login = "yes"; $admin = "yes"; include ($path."main/include/cons/head.php"); if(siteStat() == "Basketball" && $basketReg == 0){ function getPnts($round){ $f = mysql_fetch_array(mysql_query("SELECT * FROM `basket_pnts` WHERE `round` = '".$round."'")); return $f['value']; } $i = 1; $cnt = 1; while($i<=16*4){ if($i <= 16*1){ $r = "a"; }else if($i <= 16*2){ $r = "b"; }else if($i <= 16*3){ $r = "c"; }else if($i <=16 *4){ $r = "d"; } $win = $_POST[$cnt."_".$r]; $spot = $cnt; $round = $_POST['round']; if(!empty($win)){ mysql_query("INSERT INTO `basket_winner` (team, region, spot, round) VALUES ('".$win."', '".$r."', '".$spot."', '".$round."')")or die(mysql_error()); $pnt = getPnts($round); $table = "basket_rnd".$round; $q = mysql_query("SELECT * FROM `".$table."` WHERE `".$spot."` = '".$win."' AND `region` = '".$r."'"); while($f = mysql_fetch_array($q)){ $usr = $f['user']; $p = mysql_query("SELECT * FROM `basket_usrpnts` WHERE `user` = '".$usr."'"); $p = mysql_fetch_array($p); $brnd = "rnd".$round; $rnd = $p[$brnd]; $total = $p['total']; $rnd+=$pnt; $total+=$pnt; mysql_query("UPDATE `basket_usrpnts` SET `".$brnd."` = '".$rnd."', `total` = '".$total."' WHERE `user` = '".$usr."'"); echo $table." ".$spot." ".$usr." ".$pnt; } } $i++; if($cnt <= 16){ $cnt++; }else{ $cnt = 1; } } //header("Location: up_win.php"); }else{ header("Location: ../index.php"); } include ($path."main/include/cons/foot.php"); ?> Link to comment https://forums.phpfreaks.com/topic/151475-solved-action-script-not-executing-some-code/ Share on other sites More sharing options...
Philip Posted March 28, 2009 Share Posted March 28, 2009 Well, if it is redirecting it means: if(siteStat() == "Basketball" && $basketReg == 0) is failing A few things I would do. Check to see if those variables are coming out to what they should - if not (which they aren't) find the source. Also, add in error_reporting(E_ALL); to the top of the script to see if something is causing a warning/error. Link to comment https://forums.phpfreaks.com/topic/151475-solved-action-script-not-executing-some-code/#findComment-795659 Share on other sites More sharing options...
Lamez Posted March 28, 2009 Author Share Posted March 28, 2009 no I fixed it Link to comment https://forums.phpfreaks.com/topic/151475-solved-action-script-not-executing-some-code/#findComment-795664 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.