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

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -