Hello everyone,
Can anyone tell me what is wrong with my PHP script? I am trying to add
information to an MSSQL database from a separate HTM file. The script it
as follows:
<?php
$myEmployeeName=$_GET['name'];
$myEmployeeDept=$_GET['department'];
$myEmployeeNotes=$_GET['notes'];
$myEmployeeCTP=$_GET['ctp_op'];
$myServer = "192.92.0.248";
$myUser = "repro";
$myPass = "repro";
$myDB = "repro";
error_reporting(E_ALL);
print ("<p class=\"text\"><b>Attempting To Connect To MSSQL -
</b><br><br>");
$s = @mssql_connect($myServer, $myUser, $myPass)
or die("Couldn't Connect To SQL Server On $myServer<br>");
print ("<u>Stage 2</u><br>");
$d = @mssql_select_db($myDB, $s)
or die("Couldn't Open Database $myDB<br>");
#this is the create bit
print ("Connected - Attempting To Create Employee...<br>");
if ($mYEmployeeCTP == "on") {
$query = "INSERT INTO users (name, department, notes, ctp_op)
VALUES ('$myEmployeeName', '$myEmployeeDept', '$myEmployeeNotes', 'Y')";
$result = mssql_query($query)
or die("Creating Employee Failed");
} else {
$query = "INSERT INTO users (name, department, notes, ctp_op)
VALUES ('$myEmployeeName', '$myEmployeeDept', '$myEmployeeNotes', 'N')";
$result = mssql_query($query)
or die("Creating Employee Failed");
}
print ("Employee Added To Database<br><br>");
print ("<a href=\"index.htm\" class=\"link\">Go back to index</a></p>");
?>
Thanks in advance
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php