How do I get the multivalued value of a column in a database?
Now I am trying to create a new code with a link from Swellar. but I do not know why. this code doesn't work at all. it will not show data. just show blank page
this code
<?php
$db = mysqli_connect("localhost","root","","silo");
$sQuery = "SELECT * FROM temp5";
$rResult = $db->query($sQuery);
$aResult = array();
while($aRow = mysqli_fetch_array($rResult)){
$aResult[] = $aRow;
}
// explode each row and store in a new array
$aResultArrays = array();
foreach ($aResult as $row){
$aResultArrays[$row['no']] = explode(',',$row['nama']);
}
I have a problem calling multiple data from a database column. I want to call this a separate value.
in circle i. I want to call it on the table, but first I have to separate them. the table i want to create as
just an example:
|Nurudin |09-07-2017|;
|Nur Chotib| 09-07-2017|;
|Heri Prasetyo| 09-07-2017|;
|Moch Ali Imron| 09-07-2017;
Hopefully someone can give me some sample code for me.
source to share
Using explode () :
$names = explode(",",$retrievedNames);
foreach($names as $name)
{
echo '|'.$name.'|'.$retrievedDate.'|';
}
source to share
While the answers were given, this issue should not have occurred in the first place, since having multiple values ββin one column is against database normalization , even 1NF.
Instead, create a new table for all your values ββin "Nama" and another to map that table ID to the new one.
Example Here
source to share