The attached code pulls data from my MySQL database & displays it in a browser & it works great but I need it to do one more thing & I can’t figure out a way to make it work & ask for your help. If you look at lines 177 - 187, this is where I need the assistance. At this time these lines of code pull the NAMES from the CLERK_NAMES table WHERE the ACTIVE field is set to 1.
Here is what I need help with…once the user clicks the “Place Assignments” button, I need for the ACTIVE field to be updated to a 0…can anyone help me with this? Thanks
[php]
To go to the main page click here.
<?php $page_title = 'Edit a Record'; $con = mysql_connect("localhost","uname","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("flow", $con); ini_set('display_errors',1); error_reporting(E_ALL); if ( (isset($_GET['id'])) && (is_numeric($_GET['id'])) ) { $id = $_GET['id']; } elseif ( (isset($_POST['id'])) && (is_numeric($_POST['id'])) ) { $id = $_POST['id']; } else { // No valid ID, kill the script. echo 'Page Error
This page has been accessed in error.
The assignment has been submitted successfully!
An email containing all this information has been sent to the assigned employee.
'; switch($_REQUEST['employee']) { case "John Doe": $Email = "[email protected]"; break; case "Jane Doe": $Email = "[email protected]"; break; case "Greg Johnson": $Email = "[email protected]"; break; default: echo "Error, no employee selected!!!"; break; } $Message = "Someone Has Been Assigned to You Below.\n \nName : ${_REQUEST['fname']} ${_REQUEST['mname']} ${_REQUEST['lname']} \nitem No : ${_REQUEST['item']} \nemployee : ${_REQUEST['employee']} \nLocation : ${_REQUEST['location']}"; $Subject = "Assignment"; $Headers = "From: [email protected] \n"; if (mail($Email, $Subject, $Message, $Headers)) exit(); } else { echo 'Error!
The following error(s) occurred:
';
foreach ($errors as $msg) {
echo " - $msg
\n";
}
echo '
If you continue to get this error call IT.
echo ’
This section assigns the it to an employee & a clerk. Your person will not be notified until the employee enters the information.
item No: |
Location: |
|
First Name: |
Middle Name: |
Last Name (Corporation/Partnership): |
Assign To This employee: John Doe Jane Doe Greg Johnson |
';
} else { // Not a valid user ID.
echo ‘
Page Error
This page has been accessed in error.
}
mysql_close(); // Close the database connection.
?>
<?php $mysqli = new mysqli('localhost', 'uname', 'password', 'flow'); $sql = "SELECT names FROM clerk_names WHERE active = '1' ORDER BY RAND() LIMIT 1"; $res = $mysqli->query($sql); $row = $res->fetch_row(); $randomName = $row[0]; $res->free(); ?>[/php]