I have been banging my head against the wall on this for about 2 hours now and I cannot figure out what im doing wrong. I am simply trying to update a MySQL database with new information. but when I click "Update Information" nothing is happening.
<div id="tabs-1">
<?php
//update main informaion
if(isset($_POST["toolnameupdate"])){
$companyname1 = "";
$toolname1 = "";
include_once("../php_includes/db_connect.php");
$companyname1 = $_POST['clientname'];
$toolname1 = $_POST['webtoolname'];
$sql = "UPDATE siteinformation SET clientname = $companyname1, srcname = $toolname1";
$query = mysqli_query($db_connect, $sql);
error_reporting(E_ALL);
header('Location: user.php');
}
?>
<form method="post" action="">
<fieldset>
<legend><strong>Main Title Information</strong></legend>
<div id="prompt">Client Company Name:</div><div id="answer"><input type="text" name="clientname" id="clientname" value="<? echo $companyname; ?>"/></div>
<div id="prompt">Web Tool Name:</div><div id="answer"><input type="text" name="webtoolname" id="webtoolname" value="<? echo $toolname; ?>"/></div>
<div id="prompt"><input type="submit" id="toolnameupdate" name="toolnameupdate" value="Update Information" /></div><div id="answer"> </div>
<div id="prompt"> </div><div id="answer"> </div>
</fieldset>
</form>
</div>
Can anyone see where it is missing information?
Thanks
WHEREcondition in your update query, it's going to update ALL rows. Are you sure you don't meanINSERT? Also there's just so much wrong with this code that should have raised a few errors.error_reporting(E_ALL);will make sure you actually see them.error_reporting(E_ALL);sets the error reporting for subsequent calls. You should move it to the top of the file so you can see any database call errors. Also look atmysqli_error()aftermysqli_queryis called for errors with your SQL syntax.