mysql - how to update table by clicking a link in php -
i have project create point system students. student may @ solutions question, if do, should lose 2 pts , profile should updated new point score. possible update table clicking on link? attempted following:
if($points >0) { if(($status== '') || ($newuniq_id!= $uniq_id) || ($newquestion_id!= $quid)) { $query = "insert status(uniq_id, user_id, user_name, question_id, status) values('$uniq_id', '$id','$name','$quid','read')"; mysql_query($query); $newpoints = $points - $cut_points; $newquery1 = "update $tabl_u set points = '$newpoints' uniq = '$uniq1'"; $newquer2 = mysql_query($newquery1); } }
assuming php script myscript.php
you can create each link reference script uniqid of item want update.
<a href="myscript.php?update=true&uniqid=<?=$uniqid?>" />
then in script, can check update request:
if (isset($_get['update'])){ $uniqid= $_get['uniqid']; $newquery= // update statement }
Comments
Post a Comment