Results 1 to 4 of 4
Thread: new mysql table setup
Mar 29, 2005, 14:04 #1
new mysql table setup *Solved*
I am creating a new table containing information about different weekling summer camps. I am having trouble developing the structure.
All is good till i get to the ages or in this case, the school grades of the kids that will be allowed to go to each camp. it will be somthing similar to this when displayed:
name: camp 1
I thought initially about seting grades as a varchar, and inputing in "9-12" however, when performing a search over this field, 10th and 11th grade query's would not return any successful results. So i thought maybe an integer, but i can't have a value of "9, 10, 11, 12"
my last thought was a varchar that would convert the input grades into this format: "9, 10, 11, 12" this would work, howver, how would i go about displaying...in php:
from this data
varchar grades: "9,10,11,12"
any help would be great thanks.
Last edited by Raskolnikov; Apr 1, 2005 at 08:21.
Mar 29, 2005, 15:42 #2
- Join Date
- Apr 2004
- 0 Post(s)
- 0 Thread(s)
use the explode function to load the values into an array ie.
$gradesArray = explode(", ", $grades);
this should probably be posted in the php forum
Mar 30, 2005, 09:02 #3
I was more curious as to the column typ for that variable. in this case if i go with this kind of display i should use a varchar of some sort. When loading the data into the db it should go in as an array or would it be just as easy to implode them all to somthing like: "9,10,11,12"?
Apr 1, 2005, 08:22 #4
THat seemed to work.
I created a carchar, took the info from checkboxes, and imploded them into a string, then on the other end exploded them to an array for display.