Note that there are some explanatory texts on larger screens.

plurals
  1. POI can't figure out why one of these PHP scripts is not working
    primarykey
    data
    text
    <p>I have two scripts doing almost the same things but one of them is not working. I just can't figure where is the problem. Both scripts have almost the same code but the "update message" script is not working. I do not get any php error but the database is not updating.</p> <p>Delete script (working) :</p> <pre><code>&lt;?php function deleterow() { $con=mysqli_connect("localhost","root","root","TP1AlexandreBouletCouture"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $delete_id = ($_GET["delete_id"]); $sql="DELETE FROM `table1` WHERE `table1`.`id` = '$delete_id'"; if (!mysqli_query($con,$sql)) { die('Error: ' . mysqli_error($con)); } echo '&lt;p&gt;Message supprimé&lt;/p&gt;'; mysqli_close($con); } if(isset($_GET['delete_id'])) { deleterow($_GET['delete_id']); } ?&gt; &lt;form action="history.php" method="get"&gt; &lt;input type="submit" value="Supprimer"&gt; &lt;input type="hidden" name="delete_id" value='.$row['id'].'&gt; &lt;/form&gt; </code></pre> <p>Update message script (not working) :</p> <pre><code>&lt;?php function updatemyinfos() { $con=mysqli_connect("localhost","root","root","TP1AlexandreBouletCouture"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $update_id = ($_GET["update_id"]); $new_message = ($_GET["updatemessage"]); $sql="UPDATE `table1` SET `message` = '$new_message' WHERE `table1`.`id` ='$update_id"; if (!mysqli_query($con,$sql)) { die('Error: ' . mysqli_error($con)); } echo '&lt;p&gt;Message modifié&lt;/p&gt;'; mysqli_close($con); } if(isset($GET['updatemessage'])) { updatemyinfos($GET['updatemessage']); } ?&gt; &lt;form action="history.php" method="get"&gt; &lt;textarea style="resize:none"cols="35"rows="3"name="updatemessage"&gt;'.$row['message'].'&lt;/textarea&gt; &lt;input type="submit" value="Modifier"&gt; &lt;input type="hidden" name="update_id" value='.$row['id'].'&gt; &lt;/form&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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