I am build a data structure using multidimensional associative arrays. Can I update that data structure into a mysql table field and then read it back again?
Here is an example of what I am trying to do:
$result = mysql_query("select * FROM color") or die(mysql_error());
$colors = "";
while($colorrec = mysql_fetch_array($result)){
$colors[$colorrec['ID']][0] = $colorrec['Description'];
$colors[$colorrec['ID']][1] = $colorrec['HexCode'];
}
If I now do:
mysql_query("UPDATE tempfile SET ColorInfo = '".$colors."' WHERE ID = '".tempID."'");
Can I then do:
$result = mysql_query("select * from tempfile WHERE ID = '".tempID."'");
$temprec = mysql_fetch_array($result);
$colors = $temprec['ColorInfo'];
You could serialize it to hold it’s data type, then unserialize it when you fetch it back.