Jump to content

[SOLVED] Am I missing Something? My Update Querys


Lamez

Recommended Posts

The idea behind this bit of code is to take the previous submitted information, which are the winners of the foot bowl, then to find all the users that have picked that team to win. If they did pick that team, then it will (suppose) take the pnt value, and add it to the db in the foot_picks table, then take their total, and it it there, and update the foot_pnt table. Well nothing is being updated at all!

 

here is the buggy code:

<?php
ob_start();
$path = "../../";
$u_login = "yes";
$admin = "yes";
$rank = "yes";
include ($path."main/include/cons/head.php");
$name = $_POST['name'];
$team = $_POST['team'];
$pnt = $_POST['pnt'];
$q = mysql_query("SELECT * FROM `foot_picks` WHERE `team` = '".$team."' AND `bowl_name` = '".$name."'");
while($f = mysql_fetch_array($q)){
mysql_query("UPDATE `foot_picks` WHERE `team` = '".$team."' SET `pnt` = '".$pnt."'");
$t = mysql_query("SELECT * FROM `foot_pnt` WHERE `user` = '".$f['user']."'");
$n = mysql_fetch_array($t);
$tot = $n['total'] + $pnt;
mysql_query("UPDATE `foot_pnt` WHERE `user` = '".$f['user']."' SET `total` = '".$tot."'");
}
echo "All Done!";
include ($path."main/include/cons/foot.php");
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.