aka J Love Community Supporter?
Bill Gates is my home boy
Gender:
Posts: 886
1148 credits Members referred : 4
« on: Aug 26, 2006, 09:00:53 pm »
trying to make it so i can set these things to do as completed by clicking a link.. im pretty sure i have done most of it right and it says taht it successfully marked it as complete, but it doesnt. thing_status stays at 0 when it should be 1:
list of things with link to complete it
Code:
<?php echo "<center>";
$result2 = dbquery("SELECT * FROM fusion_things2do_cats ORDER BY cat_id"); while ($data2 = dbarray($result2)) { $result = dbquery("SELECT * FROM fusion_things2do WHERE thing_cat = " . $data2['cat_id']); while ($data = dbarray($result)) { echo $data['thing_id']; echo ". <b>".$data['thing_name']."</b><br>"; echo "<i>Item Category: ".$data2['cat_name']."</i><br>"; echo $data['thing_description']; echo "<br><br>"; if ($data['thing_status'] == 0){ echo "[<a href='done_thing.php".$aidlink."&cmd=completed&thing_id=".$data['thing_id']."'>Mark As Completed</a>]<br><hr width='30%'><br>"; } else { echo "<font color='yellow' weight='bold'>Item Completed.</font><br><hr width='30%'><br>"; } } } echo "</center>"; ?>
this is the page that performs the complete command
if (!checkrights("KA") || !defined("iAUTH") || $aid != iAUTH) fallback("../index.php"); opentable('Set Thing to Do as Complete');
if($_GET["cmd"]=="completed") { $getcompleted = mysql_query("SELECT * from fusion_things2do order by thing_id asc"); while($data = mysql_fetch_array($getcompleted)) { if(!isset($cmd)) { $result = mysql_query("UPDATE fusion_things2do SET thing_status = 1 WHERE thing_id = " . $data['thing_id']); while($r=mysql_fetch_array($result)) { $thing_id=$r['thing_id']; } } } $sql = "SELECt * FROM fusion_things2do WHERE thing_id=$thing_id"; $result = mysql_query($sql); echo "<center>Thing to Do has been marked as completed!<br><br>Click [<a href='".BASEDIR."administration/things_todo.php".$aidlink."'>here</a>] to return to the Things to Do.</center>"; } closetable();
if (!checkrights("KA") || !defined("iAUTH") || $aid != iAUTH) fallback("../index.php"); opentable('Set Thing to Do as Complete');
if($_GET["cmd"]=="completed") { $getcompleted = mysql_query("SELECT * from fusion_things2do order by thing_id asc"); while($data = mysql_fetch_array($getcompleted)) { //if(!isset($cmd)) //{ $result = dbquery("UPDATE fusion_things2do SET thing_status = 1 WHERE thing_id = " . $data['thing_id']); while($r=dbarray($result)) { $thing_id=$r['thing_id']; } //} } $sql = "SELECt * FROM fusion_things2do WHERE thing_id=$thing_id"; $result = mysql_query($sql); echo "<center>Thing to Do has been marked as completed!<br><br>Click [<a href='".BASEDIR."administration/things_todo.php".$aidlink."'>here</a>] to return to the Things to Do.</center>"; } closetable();