PHP script not updating mysql table -
this script not working... can tell me i'm doing wrong?
$id = $_post['id']; $name = $_post['name']; $date = $_post['date']; $shortdesc = $_post['shortdesc']; $link = $_post['link']; $target = $_post['target']; $sort = $_post['sort']; $html = $_post['html']; include('appvars.php'); $query = "update insight set name='".$name."' , set date='". $date . "' , set html='" . $html . "' , set shortdesc='" . $shortdesc . "' , set link='" . $link . "' , set target='" . $target . "' , set sort='" . $sort . "' id='" . $id . "'"; mysqli_query($dbc, $query);
you aren't escaping values vulnerable sql injection , construction of invalid statements. example, if of input strings contain apostrophe cause code fail.
have @ prepared statements make easier construct queries parameters.
in query need use commas instead of and set.
$query = "update insight set name='foo', date='2012-12-10' id=42"; the syntax update described in mysql documentation:
Comments
Post a Comment