Note that there are some explanatory texts on larger screens.

plurals
  1. POUpdating MySQL db
    text
    copied!<pre><code>&lt;?php $host="localhost"; // Host name $username=""; // Mysql username $password=""; // Mysql password $db_name="hsp_property"; // Database name $tbl_name="project_directory"; // Table name // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); //Get values from form $id = $_POST['id']; $hospital = $_POST['hospital']; $project = $_POST['project']; $state = $_POST['state']; $status = $_POST['status']; $da_status = $_POST['da_status']; $pm = $_POST['pm']; $budgett = $_POST['budgett']; $budgetat = $_POST['budgetat']; $pdapproval = $_POST['pdapproval']; $pdcs = $_POST['pdcs']; $pdcd = $_POST['pdcd']; $pdcf = $_POST['pdcf']; $pnm = $_POST['pnm']; $prm = $_POST['prm']; $comments = $_POST['comments']; // update data in mysql database $sql="UPDATE $tbl_name SET Hospital='$hospital', Project='$project', State='$state',Project_Status='$status',DA_Status='$da_status',Project_Manager='$pm',Budget_Total='$budgett',Budget_Approved='$budgetat',Project_Approval_Dates='$pdapproval',Project_Contstruction_Dates='$pdcs',Project_Contract_Dates='$pdcd',Project_Current_Dates='$pdcf',Program_Next_Milestone='$pnm',Program_Milestone='$prm',Comments='$comments' WHERE id='$id'"; $result=mysql_query($sql); // if successfully updated. if ($result) { header ('Location: ../project_directory.php'); } else { echo 'Error'; } ?&gt; </code></pre> <p>The above is some code to update a MySQL db, i'm running WAMP to test the website before I'll upload. </p> <p>I've been using the phpeasysteps tutorial as php and mysql is new to me. It's been working all ok until now.</p> <p>Would love to know what i'm doing wrong, the PhpEasySteps tutorial might be a tad old as i've had to update a few elements of the initial code to get it to work..</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