Update problems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm trying to update a record in a MSSQL database.  When I execute the
following code on an IIS5 webserver, I get an error message that says:

PHP Warning: odbc_do(): SQL error: [Microsoft][ODBC SQL Server Driver][SQL
Server]Invalid column name 'Tom'., SQL state S0022 in SQLExecDirect in
E:\web\phptest\dbtest.php on line 31

This is after I've submitted the name Tom in the form.  Does anyone have any
ideas?!
Thanks very much in advance!
-Kermit

<?php
$fname=$_POST['first'];
if (!(is_null($fname))) {
 if (!($odbccon = odbc_connect("******", "******", "******"))) {
    die("<p>Could not Connect.</p>");
 }
 else {
  echo"<p>Connected to Database.</p>";
  $sqlupdate="UPDATE UserInfo
     SET ZNum='112763', FirstName=$fname, LastName='Short', TA='00',
Building='1197', Room='112',  Div='FWO', Grp='IIM'
     WHERE ZNum='112763'";
  $sqlupdresults=odbc_do($odbccon, $sqlupdate);
  $query="SELECT * FROM UserInfo WHERE ZNum=112763";
  $qresults=odbc_do($odbccon, $query);
  odbc_result_all($qresults, "border=1");
  odbc_close($odbccon);
  echo "<p>Connection Closed.</p>";
 }
}
else {
 ?>
 <form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post"
name="test">
  First Name: <input type="text" name="first" /><br />
  <input type="submit" name="submit" />
 </form>
 <?php
}
?>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux