I have a database called mobilemanager with one table named cc_devices it's up and tested in my wamp server, i want to pass an array to a json object and store all the data in that json page, but i'm only getting one value. this a a picture of my database after everything is done
This is the code that i'm using in titanium to pass an array
//insert into a databse
function submit_Device () {
//var request = Ti.Network.createHTTPClient();
var request = Ti.Network.createHTTPClient({
onload: function(e){
Ti.API.debug(this.responseXML);
//alert('The connection was successful!');
},
onerror: function(e){
Ti.API.debug(e.error);
alert('There was an error during submission.');
},
timeout:5000,
autoEncodeUrl:false,
});
request.open("POST","http://192.168.34.53/insertuser.php");
var params = ({"id": "4", "user": "Tony Montana" , "device": "Galaxy s2" , "project": "ABA" , "date": "7/1/2013" , "hour": "4:14 pm" , "used": "True"});
request.send(params);
alert('Device Summited');
};
And this is the PHP code
<?php
$username="root";
$password="somepass";
$database="somedb";
mysql_connect('localhost',$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$user = $_POST['user'];
$query="INSERT INTO somedb.cc_devices (user) VALUES ('" . $user . "')";
mysql_query($query);
mysql_close();
?>