Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>As per my understanding you want to send points on button click only to specific person but in your code your doing something else..</p> <p><strong>note:</strong> i added hidden variable in your form to send points to only that specific user</p> <pre><code>&lt;? include ("connect.php"); if (isset($_POST['send'])) { $username=$_POST'username']; $result = mysqli_query($conn,"SELECT * FROM members WHERE username='$username' "); $row = mysqli_fetch_array($result,MYSQLI_ASSOC); $pendingpoints = $row['pendingpoints']; $points = $row['points']; $newpoints = $points + $pendingpoints; $q=mysqli_query($conn,"UPDATE members SET points='$newpoints',pendingpoints=0 WHERE username='$username'"); if($q){ echo "Succesfully changed points for that user"; } } ?&gt; </code></pre> <p><strong>Code to show the table:</strong></p> <pre><code>&lt;? include ("connect.php"); $submit = $_POST['submit']; if ($submit) { $result = mysqli_query($conn,"SELECT * FROM members WHERE pendingpoints &gt; 0 "); $row = mysqli_fetch_array($result, MYSQLI_ASSOC); while ($row = mysqli_fetch_assoc($result)) { $username = $row['username']; $pendingpoints = $row['pendingpoints']; $points = $row['points']; $newpoints = $points + $pendingpoints; $ip = $row['ip']; echo "&lt;table border='1'&gt; &lt;tr&gt; &lt;td&gt;&lt;b&gt;Username:&lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;b&gt;Pendingpoints:&lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;b&gt;IP:&lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;b&gt;Confirm Points:&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; $username &lt;/td&gt; &lt;td&gt; $pendingpoints &lt;/td&gt; &lt;td&gt; $ip &lt;/td&gt; &lt;td&gt;&lt;form id='1' action='sendpoints.php' method='post'&gt;&lt;input type='submit' class='classname' name='send' value='Send'&gt;&lt;input type='hidden' name='username' value='$username'&gt;&lt;/form&gt;&lt;/td&gt; &lt;/tr&gt; &lt;br&gt; &lt;/table&gt;"; } } ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload