Note that there are some explanatory texts on larger screens.

plurals
  1. POUPDATED:[MySQL won't update in Where condition PHP]
    text
    copied!<p>I just updated this question. I can't seem to update my database whenever I am putting variable $ecode on my WHERE condition. But when I echo this variable it always echoes its right value.</p> <pre><code>&lt;?php require 'sqlicon.php'; $q=$_GET['q']; $ecode= $_GET['ecode']; echo"".$ecode; $result=$db-&gt;query("UPDATE offset_form SET Approved='".$q."' WHERE Employee_Code='".$ecode."'"); ?&gt; </code></pre> <p>this is the content of sqlicon.php:</p> <pre><code>&lt;?php $db=new mysqli('localhost','root','',dbuser'); //localhost,username,password, dbname ?&gt; </code></pre> <p>This is where I am getting the date for $q and $ecode: Sorry if it haven't been in mysqli yet.</p> <p>testingjava.php:</p> <pre><code>&lt;html&gt; &lt;title&gt; Offset Requests &lt;/title&gt; &lt;head&gt;&lt;link rel="stylesheet" type="text/css" href="up.css"/&gt;&lt;/head&gt; &lt;script&gt; function Approval() { var name; name=document.getElementById('ename').textContent; if(document.form1.approval[0].checked true) { alert(name); window.location.href = "sqli.php?q=Yes" + "&amp;ecode=" + name; } } &lt;/script&gt; &lt;body&gt; &lt;form id="form1" name="form1" method="post" action="testingjava.php"&gt; &lt;?php $conn = mysql_connect("localhost","root",""); if(!$conn) echo ("Could not connect"); mysql_select_db("dbuser",$conn); $query=mysql_query("Select * from offset_form where Approved=''"); while($fetch=mysql_fetch_array($query)) { $ecode=$fetch['Employee_Code']; //$_SESSION['ecode']=$ecode; $ename=$fetch['Employee_Name']; $epos=$fetch['Employee_Position']; $edpt=$fetch['Employee_Department']; $dleave=$fetch['Date_Leave']; $dreturn=$fetch['Date_Return']; $reason=$fetch['Offset_Reason']; echo "".$ecode ."".$ename." ".$epos." ".$edpt." ".$dleave." ".$dreturn." ".$reason; echo "&lt;input type='radio' name='approval' onChange='Approval()'&gt;Yes"; echo "&lt;input type='radio' name='approval'&gt;No"; echo "&lt;input type='text' name='remarks' size='30'&gt;"; echo"&lt;hr id='br'&gt;&lt;/hr&gt;"; echo"&lt;input type='submit' value='Submit' name='send' onClick='Approval()'&gt;"; } ?&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I am only testing to manipulate my database when I triggered a radio button. </p>
 

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