Note that there are some explanatory texts on larger screens.

plurals
  1. POphp wont update UPDATE QUERY
    primarykey
    data
    text
    <p>Error stating</p> <p>Notice: Undefined variable: row in E:\xampp\htdocs\Edit_Supp.php on line 9</p> <p>Notice: Undefined index: id in E:\xampp\htdocs\Edit_Supp.php on line 12 Supplier Updated</p> <p>Code: Edit_Supp_Form.php</p> <pre><code>&lt;?php $SupplierID = $_GET['id']; //Connect and select a database mysql_connect ("localhost", "root", ""); mysql_select_db("supplierdetails"); //Run query $result1 = mysql_query("SELECT * FROM suppliers WHERE SupplierID=$SupplierID"); while($row = mysql_fetch_array($result1)){ $SupplierID = $_GET['id'] = $row['SupplierID']; $SupplierID = $row['SupplierID']; $SupplierName = $row['SupplierName']; $Currency = $row['Currency']; $Location = $row['Location']; $ContactNumber = $row['ContactNumber']; $Email = $row['Email']; } ?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1- strict.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt; &lt;head&gt; &lt;meta http-equiv="content-type" content="text/html; charset=utf-8" /&gt; &lt;meta name="description" content="" /&gt; &lt;meta name="keywords" content="" /&gt; &lt;meta name="author" content="" /&gt; &lt;link rel="stylesheet" type="text/css" href="style.css" media="screen" /&gt; &lt;form action="Edit_Supp.php" method="post"&gt; &lt;br&gt; &lt;/br&gt; &lt;input type="hidden" name="SupplierID" value="&lt;?php echo $SupplierID;?&gt;"/&gt; Supplier Name: &lt;input type="text" name="SupplierName" value="&lt;?php echo $SupplierName ;?&gt;" /&gt; &lt;br&gt; &lt;/br&gt; Currency: &lt;input type="text" name="Currency" value="&lt;?php echo $Currency ;?&gt;" /&gt; &lt;br&gt; &lt;/br&gt; Location: &lt;input type="text" name="Location" value="&lt;?php echo $Location ;?&gt;" /&gt; &lt;br&gt; &lt;/br&gt; Contact Number:&lt;input type="text" name="ContactNumber" value="&lt;?php echo $ContactNumber ;?&gt;" /&gt; &lt;br&gt; &lt;/br&gt; Email:&lt;input type="text" name="Email" value="&lt;?php echo $Email ;?&gt;" /&gt; &lt;br&gt; &lt;/br&gt; &lt;input type="submit" value= "Edit Supplier Information"/&gt; &lt;/form&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>//Plus code for the Edit_Sup which is the code behind this page:</p> <pre><code>&lt;?php $con = mysql_connect("localhost", "root", ""); mysql_select_db("supplierdetails"); if (!$con) { die('Could not connect: ' . mysql_error()); } //Run a query $SupplierID= $_POST['id'] = $row ["SupplierID"]; $result1 = mysql_query ("SELECT * FROM suppliers WHERE SupplierID= '".$SupplierID."'") or die (mysql_error()); $row = mysql_fetch_array($result1); $SupplierID = $_GET['id']; $SupplierID = $_POST['id']; $SupplierName = $_POST['SupplierName']; $Currency = $_POST['Currency']; $Location = $_POST['Location']; $ContactNumber = $_POST['ContactNumber']; $Email = $_POST['Email']; $SupplierID = $row['SupplierID']; $query = "UPDATE suppliers SET SupplierName = '".$SupplierName."', Currency = '".$Currency."', Location = '".$Location."', ContactNumber = '".$ContactNumber."', Email = '".$Email."' WHERE SupplierID = '".$SupplierID."'"; $result1 = mysql_query($query); //Check whether the query was successful or not if($result1) { echo "Supplier Updated"; } else { die ("Query failed"); } ?&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