Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP update() function not working
    primarykey
    data
    text
    <p>I am developing a web application and need to update database entries as per user requirements via forms. I am using the Savant templating engine for the MVC structure. All was going fine till I went on to test the <code>update()</code> function. When I filled the update form and clicked the update button, it led to a blank screen with the URL of update.php. Here's the code of the Update.php page:<br><br></p> <pre><code>&lt;?php include_once("../../Resources/Libraries/Savant3.php"); include_once("../../Classes/Models/Test.php"); $s=new Savant3(); $s-&gt;method=$_SERVER['REQUEST_METHOD']; if($_SERVER['REQUEST_METHOD']=="GET") { $b=Test::readSingle($_GET['id']); $s-&gt;b=$b; $s-&gt;display("UpdateView.tpl"); } else { $b=new Test(); $b-&gt;id= $_POST['id']; $b-&gt;title= $_POST['title']; $b-&gt;address= $_POST['address']; $b-&gt;location= $_POST['location']; if($b-&gt;validate==true) { Test::update($b); header('location: ../../Applications/Success'); return; } } ?&gt; </code></pre> <p>I think that the problem is, most probably, somewhere in the above code. In case you wish to see the <code>update()</code> function in the model, here it is:<br><br></p> <pre><code>public static function update(Test $b) { $id=$b-&gt;id; $title=strip_tags($b-&gt;title); $address=strip_tags($b-&gt;address); $location=strip_tags($b-&gt;location); $m=new mysqli("localhost", "XXXXXXXX", "XXXXXXXXXXX", "XXXXXXXXXXX"); $s=$m-&gt;prepare("update test set title=?, post=?, location=? where id=?"); $s-&gt;bind_param("sssi", $title, $address, $location, $id); $s-&gt;execute(); } </code></pre> <p>Please help in case you have any information. This is important! Thanks in advance. :)</p>
    singulars
    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.
    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