this php code have the error when submit data to update...the error message like : Data Profil tidak dapat dicapai.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 'desc='anign',type='q' WHERE n_penyakit='angin'' at line 1...help me to solve this problem...
<?php
session_start();
include 'config.php';
$n_penyakit=$_POST["n_penyakit"];
$desc=$_POST["desc"];
$type=$_POST["type"];
$query="UPDATE penyakit SET n_penyakit='$n_penyakit',desc='$desc',type='$type' WHERE n_penyakit='$n_penyakit'";
$result=mysql_query($query) or die ('Data Profil tidak dapat dicapai.'.mysql_error());
?>
have error in php or sql...help me...
Moderator: General Moderators
Re: have error in php or sql...help me...
DESC is a reserved word; so you need to change the name of the field so it does not conflict with the reserved word, or use backticks whenever you refer to that field so MySQL knows you mean the field and not the reserved word.
Re: have error in php or sql...help me...
i change the name of the field..but the error still appear..any idea..can you give the other syntax for update function...
Re: have error in php or sql...help me...
\McInfo wrote:DESC is a reserved word; so you need to change the name of the field so it does not conflict with the reserved word, or use backticks whenever you refer to that field so MySQL knows you mean the field and not the reserved word.
it work...thanks cz help me....