There doesn't seem to be any syntax error as the select query works. Yet when i try to insert the values, it is not updated in my table. There doesn't seem to be any error in the code. The query seems to be working fine in VS. I have checked posts with the same title and attempted to apply to my code none have worked so far. Here is my code where i first encountered the issue. My question is how do i remedy this and update the table in my database ?? Any help would be appreciated, thank you for reading
$ServerName = 'SQL2008.net.dcs.hull.ac.uk';
$connectionInfo = array("Database"=>"rde_505405");
$conn = sqlsrv_connect($ServerName,$connectionInfo);
if($conn== false)
{
echo 'Connection could not be established';
exit('Disconnecting');
}
else
{
echo 'Database located!';
echo '</br>';
$StaffNUM = $_POST["SID"];
$FirstName = $_POST['Fname'];
$Surname = $_POST['Sname'];
$Location = $_POST['Location'];
$Date = date('Y-m-d h:i:sa');
echo 'First Name: ', $FirstName; Echo'</br>,</br>';
echo 'Surname: ', $Surname; Echo'</br>,</br>';
echo 'Location: ', $Location; Echo'</br>,</br>';
echo 'Entered at: ', $Date; Echo'</br>,</br>';
$SQLquery = ("INSERT INTO Location (STAFFID, 'First Name', Surname,
Location, Time)
VALUES ('".$StaffNUM."''".$FirstName."', '".$Surname."',
'".$Location."', '".$Date."');");
$results = sqlsrv_query($conn, $SQLquery);
echo '<br>';
echo '<br>';
echo 'Entry added successfully';
}
sqlsrv_close($conn);