I was trying to get some database and trying to encode it in json format, the db table contains values of both int and varchar types
$db = $this->getDBO();
$query = "SELECT * FROM ".mt_table." WHERE user_id=".$userid;
$db->setQuery($query);
$resulr= $db->loadObjectList();
var_dump($result);
I used a loadAssocList()
first and encoded it to json string but every value was taken as string, var_dump()
also shows string type.
How can I get result from database with datatype as it is in database, basically not convert everything into string maybe....
or do I need to explicitly make changes to int before I insert it into array using
array1['key']=(int)myValue;
?
I dont really know if there is any other way ..But what I did was to add (int) before storing every int values from database like $intVar = (int)var_from_db;