actually i solved the issue you are right the code that i used is, it was a logical error . should have not used the if condition here is my code might be useful for someone trying
var currentWin = Ti.UI.currentWindow;
var sendit = Ti.Network.createHTTPClient();
sendit.open('GET', 'http://192.168.0.xxx/Remote_LBR/read.php');
sendit.send();
sendit.onload = function(){
var json = JSON.parse(this.responseText);
alert("json parsed");
var json = json.tablename;
var dataArray = [];
var pos;
alert("for loop started");
// db.execute("DROP TABLE IF EXISTS tablename");
for( pos=0; pos < json.length; pos++){
dataArray.push({id:'' + json[pos].id + ''},{title:'' + json[pos].Title + ''}, {title:'' + json[pos].Latitude + ''}, {title:'' + json[pos].Longitude + ''}, {title:'' + json[pos].Description + ''}, {Approved:'' + json[pos].Approved + ''});
// set the array to the tableView
tableview.setData(dataArray);
var db = Ti.Database.install('LBR_Local.sqlite','tablename_local');
db.execute('INSERT INTO tablename(id, Title, Latitude, Longitude, Description, Approved) VALUES("'+ json[pos].id +'", "'+ json[pos].Title +'", "'+ json[pos].Latitude +'", "'+ json[pos].Longitude +'", "'+ json[pos].Description +'", "'+ json[pos].Approved +'")');
alert("Rows Inserted");
};
alert("for loop ended");
};
var tableview = Ti.UI.createTableView({
});
currentWin.add(tableview);
setData(dataArray);
Ti.App.addEventListener('reload',setData);