store array
Posted: Thu Jul 22, 2004 1:37 am
feyd | Please use
feyd | Please use
Code: Select all
tags when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
can you store an array in a mysql db, and retrieve it and use it as an array? (does the field need to be TEXT or something special?)
when i use phpmyadmin i see the value is Array basically saying i have an array stored in there -- that's fine. when i pull it out and echo it, i get Array again; that makes sense.
if i count($array) i get 1, or whatever number of items it has.
however, when i try to loop the array it doesn't run the loop. any ideas??
see code:Code: Select all
while($question = mysql_fetch_object($run_form_data))
{
while($chosethis = mysql_fetch_object($run))
{
$here = eval("return \$chosethis->question_{$question->formdataid};");
print $here; // prints "Array"
print count($here); // prints "1"
foreach($here as $temp)
{
print "[".$temp."]"; // is never run, i never see "[]"
}
}
}feyd | Please use
Code: Select all
tags when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]