Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi All,
I'm trying to write a script to generate rows in a table from arrays and sub-arrays.
Its all working lovely but i've come up against a problem... all i want to do is store the full array string in a database then retrieve it to use when its needed, the problem is that the retrieved string just acts as a string and not a set of arrays!!
This is what i'm trying to store, it should be self explanetory...
array(
array("Field1","Field2","Field3","Field4"), array("row1","row1","row1","row1"), array("row2","row2","row2","row2"), array("row3","row3","row3","row3"), array("row4","row4","row4","row4")
)this generates a 4 x 5 table in the final script but only when it is coded into the PHP as arrays.
$data = array(array("Field... works
$data = $string_from_db doesn't

Okay sorted it...
Run the array through serialize() in PHP before storing it into the MySQL DB - then when you retrieve it you can unserialize() it and hey-presto its an array again.
Lovely PHP.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |