Skip to content

Instantly share code, notes, and snippets.

@AngeloR
Created April 29, 2011 17:14
Show Gist options
  • Save AngeloR/948645 to your computer and use it in GitHub Desktop.
Save AngeloR/948645 to your computer and use it in GitHub Desktop.
Lemondoo - update_todo
<?php
function update_todo($id) {
if(is_numeric($id) && !empty($id)) {
$todo_title = mysql_real_escape_string($_POST['title']);
$todo_text = (empty($_POST['todo_text']))?$todo_title:mysql_real_escape_string($unescaped_string);
$completed = bool($_POST['completed']);
if(!empty($todo_title)) {
$sql = 'update todo set todo_title = "'.$todo_title.'", todo_text = "'.$todo_text.'", completed = '.$completed.' where todo_id = '.$id;
return json(db($sql));
}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment