Page 1 of 1

problem with UPDATE function

Posted: Tue Oct 17, 2006 3:00 pm
by amir
I am attempting to UPDATE a record and get the following error...

Error adding information for this property: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(proLot='Lot 2',proStreet='Hales Street',proStreetNo='89',proPropType'',proImpro' at line 1


can anyone see what is wrong with the code?

Please use the PHP and CODE tags when posting.

Code: Select all

<?

if(isset($_POST['editProperty']))
{
   // Connect to the database server
     $dbcnx = mysql_connect('localhost', 'poi8643_admin', 'edf742zba');
     if (!$dbcnx) {
          die("<p><b>Unable to connect to the database server at this time.</b></p>");
     }

     // Select the Point Boston database
     if (!mysql_select_db('poi8643_pointboston')) {
          die("<p>Unable to locate the Point Boston database at this time.</p>");
     }

     // insert it into the database
      $up_property_id = $_POST['up_property_id'];
      $ud_proLot = $_POST['ud_proLot'];
     $ud_proStreet = $_POST['ud_proStreet'];
      $ud_proStreetNo = $_POST['ud_proStreetNo'];
      $ud_proPropType = $_POST['ud_proPropType'];
      $ud_proImprovements = $_POST['ud_proImprovements'];
      $ud_proDimensions = $_POST['ud_proDimensions'];
      $ud_proArea = $_POST['ud_proArea'];
      $ud_proAspect = $_POST['ud_proAspect'];
      $ud_proDuplex = $_POST['ud_proDuplex'];
      $ud_proDate = $_POST['ud_proDate'];
      $ud_proPrice = $_POST['ud_proPrice'];
      $ud_proConditions = $_POST['ud_proConditions'];
      $ud_proStatus = $_POST['ud_proStatus'];
     
      $sql = "UPDATE tblProperty SET proLot='$ud_proLot', proStreet='$ud_proStreet', proStreetNo='$ud_proStreetNo', proPropType'$ud_proPropType', proImprovements='$ud_proImprovements', proDimensions='$ud_proDimensions', proArea='$ud_proArea', proAspect='$ud_proAspect', proDuplex='$ud_proDuplex', proDate='$ud_proDate', proPrice='proPrice', proConditions='$ud_proConditions', proStatus='$ud_proStatus' WHERE property_id='$ud_property_id'";

     
//      $sql = "INSERT INTO tblPropsSales (proLot, proStreet, proStreetNo, proPropType, proImprovements, proDimensions, proArea, proAspect, proDuplex, proConditions, proStatus)
//             VALUES
//            ('$proLot', '$proStreet', '$proStreetNo', '$proPropType', '$proImprovements', '$proDimensions', '$proArea', '$proAspect', '$proDuplex', '$proConditions', '$proStatus')";
?>
<table align="center" cellspacing="0px" style="width:760">
   <tr>
     <td height="10" align="left"><?      
     if (mysql_query($sql)) {
          echo "<p>Your information for $proLot has been added.</p>";  
     }
     else {
          echo "<p>Error adding information for this property: ".mysql_error()."</p>";
     }
?>
     </td>
   </tr>
</table>
feyd | fixed broken page layout. :roll:

Re: problem with UPDATE function

Posted: Tue Oct 17, 2006 3:18 pm
by Christopher
amir wrote:Error adding information for this property: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(proLot='Lot 2',proStreet='Hales Street',proStreetNo='89',proPropType'',proImpro' at line 1
The error message leads right up to the error. It looks like you are missing an "=" after proPropType.

Posted: Tue Oct 17, 2006 3:27 pm
by amir
Thanks a lot,
it works,