I am building (attemting) an online quote and buy system using php and mysql for our company. I have come to the point where i'm designing the database to record any purchases made.
Its an insurance booking system which will have to take names and ages for anything up to 10 people per booking.
Is it possible to store multiple values in the same table field? - to be later pulled out and seperated for them to be viewed.
I just wander what people suggest as I do not want to end up with creating 10 sets of name and age columns just incase there is a larger than normal booking.
Thanks
Will
Looking for some advice
Moderator: General Moderators
There is also this idea. Sorry, but it's a standard snippet I use to demonstrate:
Results:
What I'm saying, you might be able to transform the data into something obscure, but still usable before adding it to the db. Then convert it back to usable data after retrieving it. Play around with it.
Code: Select all
<pre>
<?php
$item[] = 'cow';
$item[] = 'cat';
$item[] = 'evil_smurf_of_doom';
print_r($item);
$newitem = base64_encode(serialize($item));
echo $newitem;
$olditem = unserialize(base64_decode($newitem));
print_r($olditem);
?>Code: Select all
Array
(
[0] => cow
[1] => cat
[2] => evil_smurf_of_doom
)
YTozOntpOjA7czozOiJjb3ciO2k6MTtzOjM6ImNhdCI7aToyO3M6MTg6ImV2aWxfc211cmZfb2ZfZG9vbSI7fQ==
Array
(
[0] => cow
[1] => cat
[2] => evil_smurf_of_doom
)