Code:
<?
// MySQL server hostname
$dbhost = "localhost";
// MySQL server username
$dbuser = "edited";
// MySQL server password
$dbpasswd = "edited";
// MySQL server connect
$db=mysql_connect("$dbhost","$dbuser","$dbpasswd");
// MySQL database name
$db_name="reliable_relamedata";
mysql_select_db($db_name,$db);
$table="estimate_requests";
$query = "SELECT * FROM $table WHERE id='$id'";
$result=mysql_query($query) or die(mysql_error());
$nombre = mysql_num_rows($result);
//_________________________ADD__________________________
if ($action=='add') {
if(mysql_num_rows($result)) {
echo "No Addition, the entry <b>$id</b> already exists";
}
else {
$query2="INSERT INTO $table (firstName, lastName, orginization, jobAddress, jobCity, jobState, jobZip, mailAddress, mailCity, mailState, mailZip, dayPhone, evePhone, cellPhone, faxNo, eMail, workType, estimateDesc, referer, rep_id, request_date, requestTime, status, proposal_no) VALUES ('$firstName', '$lastName','$orginization', '$jobAddress', '$jobCity','$jobState', '$jobZip','$mailAddress', '$mailCity','$mailState', '$mailZip', '$dayPhone', '$evePhone', '$cellPhone', '$faxNo', '$eMail', '$workType', '$estimateDesc', '$referer', '$rep_id','$request_date', '$requestTime', '$status', '$proposal_no')";
$result2=mysql_query($query2);
echo "The entry $firstName $lastName was added to the Lead Bank.<br>";
echo "<a href=\"open_estimates.php\">View Open Estimates.</a>
<a href=\"index.php\">Return to Employee Home Page.</a> <br>";
}
}
else {
echo "You can not access this file directly.";
} ?>
Bookmarks