I am try to update a table, but it dose not work. The desc field caused the error (it is a of type TEXT). It works if I remove the line that updates one field called "desc". I had a problem inserting, but when I used mysql_escape_string() function the data it worked. But, I do that and it still cause an error. Bellow is the code:
$address = $_POST['address'];
$city = $_POST['city'];
$pc = $_POST['pc'];
$province = $_POST['province'];
$desc = mysql_escape_string($_POST['desc']);
$propertytype = $_POST['propertytype'];
$buildingtype = $_POST['buildingtype'];
$years = $_POST['years'];
$contact = $_POST['contact'];
$foundationType = "";
for($i = 0; $i < count($_POST['foundationType']);$i )
$foundationType .= $_POST['foundationType'][$i]." ";
$con = msqlDBConnect();
if(!$con) {
return "ERROR 3: Database error could not edit account. Please try again";
}
mysql_select_db("dryb4554_projects",$con...
$sql = "UPDATE projects_1 SET ";
$sql .= "address='$address', ";
$sql .= "city='$city', ";
$sql .= "pc='$pc', ";
$sql .= "province='$province', ";
$sql .= "desc='$dsc', ";
$sql .= "propertytype='$propertytype', ";
$sql .= "buldingtype='$buildingtype', ";
$sql .= "buildingage='$years', ";
$sql .= "foundationtype='$foundationType', ";
$sql .= "contact='$contact' ";
$sql .= "WHERE id=".$_GET['id'];
if(!mysql_query($sql,$con))
{
mysql_close($con);
return "ERROR 4: Database Error. Unable to update info. please try again.<BR>";
}
I have done everthing I think of. I have checked to make sure that the name is correct. Even if I just right a word in like 'hello' it still dose ont work. If I remove the one line it works, but with the line that adds the desc to sql string is added it query fails. Is there something I don not know about TEXT type???
Tags: