mysql - PHP Script not updating sql -
here code.
<center> <html> <body> <form method="post" name="awardlist" action="<?php echo $_server['php_self']?>"> <script> function awardsort($id) { document.awardlist.hiddenid.value = $id; document.awardlist.submit(); } </script> <table border=1> <input type="hidden" name="hiddenid" /> <tr> <th><b>award</b></th> <th><b>issue id</b></th> <th><b>sort #</b></th> <th><b>submit</b></th> </tr> <?php $userid = ($vbulletin->userinfo['userid']); $query = ("select a.*, userdisplayorder, issue_id award join award_user aw on a.award_id = aw.award_id aw.userid = '$userid'"); if (isset($_post['submit'])){ $userdisplayorder = mysql_real_escape_string($_post['userdisplayorder']); echo $_post[hiddenid]; echo '<br>'; echo $userdisplayorder; $sql = mysql_query("update award_user set userdisplayorder='$userdisplayorder' userid='$userid' , issue_id='$_post[hiddenid]'"); } $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)){ $awardimgurl = $row['award_img_url']; $id = $row['issue_id']; $userdisplayorder = $row['userdisplayorder']; echo '<tr>'; echo '<th>'; echo "<img src='$awardimgurl'>"; echo '</th>'; echo '<th>'; echo '<input type="text" name="issueid" readonly="readonly" value="' . $id . '" size="5">'; echo '</th>'; echo '<th>'; echo '<input type="text" name="userdisplayorder" value="' . $userdisplayorder . '" size="5">'; echo '</th>'; echo '<th>'; echo "<center><input type='submit' name='submit' value='submit' onclick=awardsort('$id')></center>"; echo '</th>'; echo '</tr>'; } ?> </table> </html></center>
it looks on webpage:
edit: here additional info.
i modified code see printing
results:
the award issue id fine now. however, sort # not working. if change first award issue_id 88 sort # 3, go 0. however, can change issue_id 14537's sort # anything, , work. change issue_id 14537's sort # 5, go , change issue_id 5's sort # 3, go 5. it's using whatever value in sort # issue_id 14537 instead of it's own. tried make function $userdisplayorder make unique $id is, however, can't figure out how 2 onclick's.
Comments
Post a Comment