Created
April 29, 2011 17:04
-
-
Save AngeloR/948626 to your computer and use it in GitHub Desktop.
Lemondoo - add_todo()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function add_todo() { | |
| $todo_title = mysql_real_escape_string($_POST['todo_title']); | |
| $todo_text = (empty($_POST['todo_text']))?$todo_title:mysql_real_escape_string($_POST['todo_text']); | |
| if(!empty($todo_title)) { | |
| $sql = 'insert into todo (todo_title,todo_text) values ("'.$todo_title.'","'.$todo_text.'")'; | |
| if(db($sql)) { | |
| return json(db('select todo_id from todo order by todo_id desc limit 1')); | |
| } | |
| } | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment