1
I entered several data inside the same column with the implode
, now I want to extract the results of the query with the explodes so as to keep the data separate so that later I can work them.
I have the code this way, but it’s not returning anything in the arrays:
$conn = new mysqli($servername, $username, $password, $dbname);
$conn->set_charset('utf8');
$sql = "SELECT arrachar FROM centrodb.marcacaoInfancia";
$result = mysqli_query($conn, $sql);
$result1 = explode(' ', $result);
echo $result1[0];
echo $result1[1];
echo $result1[2];
echo $result1[3];
echo $result1[4];
echo $result1[5];
echo $result1[6];
echo $result1[7];
echo $result1[8];
echo $result1[9];
echo $result1[10];
echo $result1[11];
As exemplified returns all the statements that exist in the table, but always followed, example:
array(1) { [0]=> string(92) "2018-04-26,Peq_Almoço,14,Almoço,12,Almoço_(Dieta),2,Lanche,14,Jantar,10,Jantar_(Dieta),10" } array(1) { [0]=> string(91) "2018-04-27,Peq_Almoço,15,Almoço,12,Almoço_(Dieta),3,Lanche,15,Jantar,12,Jantar_(Dieta),2" }
. I wanted to have this result separate, to be able to mount a table for the end user to consult– Bruno
You have to make it explode with a comma
– lazyFox