[thelist] matched pairs php + mysql

Andrew thelist at punterspower.co.uk
Sun Sep 19 03:32:01 CDT 2004

Sounds Interesting Max,

The senario is this:  I have a html table (actualy there will be two) the
html table is currently stored in one field of a table
(product_description) which is related to the main product table.  I am
cutting and pasting the html table inot the description field presently
and is a pain.  I would much more prefer to have the fields of the html
table added as data and when reqested pulled out and presented in html
table on the forntend of the site.

The html table will be different for every product so to componsate for
this I figure a 7 column 7 row table for inputting the data would cover
all senarios.  Having 49 fields in a table is not the way forward, I heard
of matched pairs but couldn't find anything out about this.

After pondering about the solution for this I thought that the data could
possible be stored in one field as comma seperated and then pulled out and
formatted accordingly, as an array as you suggested (although I haven't
done this before so wanted a little help :)

I'm not sure if I have made any more sense for this puzzle of mine so any
questions to clarify would be welcome.


Maximillian Schwanekamp said:
> Andrew wrote:
>>I want to store a set of data in one field of a table that can be pulled
>>out and formatted the same way that it was input ( style).
>>eg I have a table with say 6 rows 6 columns the data input will be stored
>>in one field (presumably seperated by  a comma, the data can then be
>>pulled out and presented in the same way it was input, ie if r3 c4
>> contain
>>data that is where it will be displayed on the fronted?
> Not sure why you would do it this way, but perhaps PHP's serialize() and
> unserialize() would work for you here.  Your tabular data can be
> represented as an array of arrays (e.g. $arrTable), which can then be
> made into a string for storage in MySQL using serialize($arrTable).  On
> output, you would pull the data from MySQL, and use unserialize() to
> convert the string data back into your array.  If you need to go
> further, you can serialize() entire objects as well - but note the
> caveats described in PHP manual.
> All this said, you might give a little more detail about what you're
> doing - maybe someone here will have a more robust solution.  Presenting
> tabular data is a classic SQL task.
> --
> Maximillian Von Schwanekamp
> Dynamic Websites and E-Commerce
> NeptuneWebworks.com <http://www.neptunewebworks.com/>
> voice: 541-302-1438
> fax: 208-730-6504
> --
> News! - Evolt.org conference for web professionals.
> 17-19 September 2004 in Toronto, Canada.
> Details at http://TOevolt.org
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !

More information about the thelist mailing list