Mysql Syntax :You have an error in your SQL syntax....
Posted
by jasmine
on Stack Overflow
See other posts from Stack Overflow
or by jasmine
Published on 2010-04-03T13:49:36Z
Indexed on
2010/04/03
13:53 UTC
Read the original article
Hit count: 381
I have written very very very!!! simple function:
function editCategory() {
$ID = urlencode($_GET['id']);
$cname = mysql_fix_string($_POST['cname']);
$kabst = mysql_fix_string($_POST['kabst']);
$kselect = $_POST['kselect'];
$subsl = $_POST['subsl'];
$kradio = $_POST['kradio'];
$ksubmit = $_POST['ksubmit'];
if (isset($ksubmit)) {
$query = "UPDATE category SET name = '$cname', description = '$kabst', published = '$kselect', home = '$kradio', subcat = '$subsl' WHERE id = $ID ";
$result = mysql_query($query);
if (mysql_affected_rows () == 1) {
echo "ok";
}
else{
echo mysql_error();
}
}
}
error:
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 '' at line 1
what is wrong? :(
© Stack Overflow or respective owner