hi guys
Need help with an update option, below is a script to display the details of a staff member from the table staff, as the details are printed perfectly, I would like to save changes to the fields if anyone makes changes for example change the last_name field.
here is an example of my pesudo code
if (submit button is clicked)
{
update all the fields (data {}) to the db table
}
could someone gime a few hint in using the update function in mysql as i have never seen or used it before....
<?php
session_start();
header("Cache-control: private");
include_once("start_page_login.php");
print("<h1><center>Welcome to the tests page <b>".$_SESSION["login"]."</center></h1></b><br>\n");
include_once("start_page_admin.php");
include_once("config.php");
include_once("forms.php");
doCSS();
$query = "select staff_ID, first_name, last_name, faulty_id, date_started, group_id, module_id, module_id2, module_id3 from staff order by staff_id";
$result = mysql_query($query);
//will work. then to put all the results in textboxes
// Run query:
$result=mysql_query($query, $link) or die("MySQL query $query failed. Error if any: ".mysql_error());
$data = mysql_fetch_array($result);
echo "<input type=\"text\" name=\"staff_id\" value=\"{$data[0]}\"><br />\n";
echo "<input type=\"text\" name=\"first_name\" value=\"{$data[1]}\"><br />\n";
echo "<input type=\"text\" name=\"last_name\" value=\"{$data[2]}\"><br />\n";
echo "<input type=\"text\" name=\"faulty_id\" value=\"{$data[3]}\"><br />\n";
echo "<input type=\"text\" name=\"date_started\" value=\"{$data[4]}\"><br />\n";
echo "<input type=\"text\" name=\"Group_id\" value=\"{$data[5]}\"><br />\n";
echo "<input type=\"text\" name=\"Module_id\" value=\"{$data[6]}\"><br />\n";
echo "<input type=\"text\" name=\"module_id2\" value=\"{$data[7]}\"><br />\n";
echo "<input type=\"text\" name=\"module_id3\" value=\"{$data[8]}\"><br />\n";
?>