I mysql_real_escape_string everything on a regular basis, and a var dump didn't show anything. I have this in databases, but I am by no means sure that the issue has to do with the database, since the db has been up and running for a couple of years, and has been updating properly (including the "Nused" field) in quite a few scripts. I cannot, for the life of me, see any difference in this script. It's driving me nuts.
The only differing condition is that the value for that field is being entered by the user, in this case, by means of a drop down and the value is of the nature
Code: Select all
<option value='Tlr'>Teller</option>
I'm going to play around with something different in that area and see what happens.
Edit: this is just wierd. Here's the SQL statement preparation from the $_POST array
Code: Select all
$Ptypes = array("","Oth","Tlr","Rec","Fsr");
$Inum = $_SESSION['Clnt'];
$Lnum = $_SESSION['Locn'];
$Name = mysql_real_escape_string($_POST['Name'],$Link);
$Posn = $Ptypes[$_POST['Posn']];
$Typ = 0 + $_POST['Type'];
$D = date("Y-m-d") . " 00:00:00";
if ($_POST['id'] > 0)
$Query = "UPDATE Precord SET Get=$Typ,Nused='$Posn',Name='$Name' WHERE id=" . $_POST['id'];
else $Query = "INSERT INTO Precord (id,iref,lref,Get,Name,Nused,Date) VALUES (0,$Inum,$Lnum,$Typ,'$Name','$Posn','$D')";
echo $Query;
mysql_query($Query, $Link);
And here is the resulting SQL statement:
Code: Select all
UPDATE Precord SET Get=1,Nused='Tlr',Name='William' WHERE id=20978
Two fields are updated, the "Nused" field is blanked out.
When I take that statement and paste it into phpmyadmin the statement executes without error, and the "Nused" field is updated to read "Tlr" as one would expect. Well, one would normally expect.