sophielois1
Technical User
Hi been handed a database that has a number of arrays which have been stored using the serialize() function.
As i have never stored arrays in databases before, i am having a bit of problem pulling the info and displaying it.
Would somebody be kind enough to help me.
This is what i have.
table called bank
columns know1, know2, know3, know4,
from what i can gather these are the lines of code that origannlly stored the data
I am aware that i have to use the unserialize() function, but am struggling to get it working or really know how to implement it.
i have been trying to do somethinhg like this
mmmmmmmm
really appreciate anybodies help
thanx Soph
As i have never stored arrays in databases before, i am having a bit of problem pulling the info and displaying it.
Would somebody be kind enough to help me.
This is what i have.
table called bank
columns know1, know2, know3, know4,
from what i can gather these are the lines of code that origannlly stored the data
Code:
<?
$pc1=serialize($_POST['knowledge1']);
$pc2=serialize($_POST['knowledge2']);
$pc3=serialize($_POST['knowledge3']);
$pc4=serialize($_POST['knowledge4']);
?>
$query="UPDATE bank SET know1 = '$pc1', know2 = '$pc2', know3 = '$pc3', know4 = '$pc4', submitted_date=now() WHERE userid = $userid LIMIT 1";
I am aware that i have to use the unserialize() function, but am struggling to get it working or really know how to implement it.
i have been trying to do somethinhg like this
Code:
$result = mysql_query("SELECT * FROM bank WHERE userid = '$userid'");
while($row = mysql_fetch_object($result))
{
$pc=unserialize($pc1['knowledge1']);
foreach($pc as $result)
{
echo "$result</br>";
}
mmmmmmmm
really appreciate anybodies help
thanx Soph