I'm just getting started with backbone.js and I'm working with this tutorial on Nettuts. http://net.tutsplus.com/tutorials/javascript-ajax/getting-started-with-backbone-js/
var user = Backbone.Model.extend({
initialize: function(){
console.log('user was initialized!');
},
defaults:{
'name' : 'wern',
'full_name' : 'rem falkner',
'password' : 'secret',
'email' : '[email protected]'
}
})
var u = new user()
And then I used the save method:
u.save(undefined, {url : 'inserts.php'})
Inserts.php contains:
<?php
include('conn.php');
$name = $_POST['name'];
$password = md5($_POST['password']);
$email = $_POST['email'];
$db->query("INSERT INTO tbl_users SET user_id='$name', pword_hash='$password', full_name='$name', email='$email'");
?>
What's wrong with my code? It seems to be inserting in the database because whenever I call the save() method it inserts something on the user table but only in the password field.
INSERT INTO table (fields) VALUES (values)