I have problem with mysqli. When I query the data, mysqli always returns a string.
In my database there is a table "model":
CREATE TABLE Models
(
id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
name TEXT,
PRIMARY KEY (id)
) ;
My PHP code
$mysqli = new mysqli($host,$username,$password,$database);
$resultSql = $mysqli->query('SELECT * FROM models');
$resultArray = array();
while($row = $resultSql->fetch_assoc()) {
array_push($resultArray,$row);
}
print(gettype($resultArray[0]['id']));
And print() returns to me "string". But field "id" in the database has integer data type. I was looking for some settings, but could not find it.
I tried using PDO, but I ran into the same problem. If you know the solution for PDO, I'll be happy.
Can you help me?
Thanks.