I am just a newbie in php. I have a database, in the database the data is like this
CREATE TABLE IF NOT EXISTS `list` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`data` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
INSERT INTO `list` (`id`, `data`) VALUES
(1, '5,2,3,4,1');
Now to fetch the data I have made my php code like this
<?php
$host = 'localhost';
$username = 'root';
$password = '';
$db = 'sortable';
$link=mysqli_connect($host, $username, $password, $db);
if (mysqli_connect_errno($link)) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$query = "SELECT `data` FROM `list`";
$order = mysqli_query($link, $query);
print_r($order);
?>
here its showing the result like this
mysqli_result Object ( [current_field] => 0 [field_count] => 1 [lengths] => [num_rows] => 1 [type] => 0 )
But I want the fetch values will be in array and the desired output of the array will be like this
Array([0] => Array([0]=>5,2,3,4,1[data]=>5,2,3,4,1))
So can someone kindly tell me how to do this? Any help and suggestions will be really appreciable.