UPDATE in mysql
Jens V
23/04/2006 09:44:00ik heb een vraagje over updaten in mysql. als ik dit doe:
$sql2 = "UPDATE news SET
title = $title1,
content = $content,
author = $author,
published = $published
WHERE id = $id";
mysql_query($sql2) or die(mysql_error());
dan zegt ie:
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 ' content =
Wat kan ik hieraan doen zodat het wel werkt?
$sql2 = "UPDATE news SET
title = $title1,
content = $content,
author = $author,
published = $published
WHERE id = $id";
mysql_query($sql2) or die(mysql_error());
dan zegt ie:
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 ' content =
Wat kan ik hieraan doen zodat het wel werkt?
PHP hulp
16/11/2024 10:58:20Jan Koehoorn
23/04/2006 09:51:00Er moeten enkele quotes om je vars.
edit: behalve bij $id
edit: behalve bij $id
Gewijzigd op 01/01/1970 01:00:00 door Jan Koehoorn
Jens V
23/04/2006 09:53:00dus:
$sql2 = "UPDATE news SET
title = '$title',
content = '$content',
author = '$author',
published = '$published'
WHERE id = $id";
mysql_query($sql2) or die(mysql_error());
?
$sql2 = "UPDATE news SET
title = '$title',
content = '$content',
author = '$author',
published = '$published'
WHERE id = $id";
mysql_query($sql2) or die(mysql_error());
?
Gewijzigd op 01/01/1970 01:00:00 door Jens V