This is for another menu project that I'm working on. The restaurant has a large list of daily specials, all of which fit into one of four categories (lunch, dinner, pizza, dessert). Because the data will never mix (no need for joins or unions), I wanted to keep the specials categories separate from the regular menu item categories. Because there are only four specials categories and they are static, I thought ENUM would work best. Your opinions? Edward Dudlik Becoming Digital www.becomingdigital.com ----- Original Message ----- From: "Lisi" <lists@shemeshdirectory.co.il> To: "Becoming Digital" <subs@becomingdigital.com>; "PHP-DB" <php-db@lists.php.net> Sent: Monday, 02 June, 2003 06:40 Subject: Re: Dealing with ENUM fields What's the application? What are the issues with using ENUM verses something else? -Lisi At 05:32 AM 6/2/03 -0400, Becoming Digital wrote: >Thanks to both Heilo and Lisi. These scripts should make things easier. > >Is it safe to assume that we are in agreement about the use of an ENUM >field for >this application? > >Edward Dudlik >Becoming Digital >www.becomingdigital.com > > >----- Original Message ----- >From: "heilo" <grillen@abendstille.at> >To: "PHP-DB" <php-db@lists.php.net> >Sent: Monday, 02 June, 2003 05:11 >Subject: Re: Dealing with ENUM fields > > >Hi! > >there is a much shorter way to do this (which works with ENUM and SET): > > >$qry = 'SHOW COLUMNS FROM `gruzilla_content` LIKE "module"'; >$res = mysql_query($qry); >if(mysql_num_rows($res)>0) >{ > $row = mysql_fetch_row($res); > $pattern = "#(enum|set)\('(.+?)'\)#i"; > $replace = '\\2'; > $row[1] = preg_replace($pattern, $replace, $row[1]); > $options = explode("','", $row[1]); >} > >$options now contains every value of the enum. I think there is also a >possibility to do this within a query - but currently i do not find the >script on my HD.... :) - so this is a nice workaround! > >.ma > > >Lisi <lists@shemeshdirectory.co.il> wrote@02.06.2003 11:53 Uhr: > > > I am forwarding this useful function someone once sent to the list that I > > use often. > > > > Hope this fits your needs. > > > > -Lisi > > > > > >> -----Original Message----- > >> From: Russ [mailto:russ@itomic.dns2go.com] > >> Sent: Wednesday, June 26, 2002 7:47 PM > >> To: NIPP, SCOTT V (SBCSI); php-db@lists.php.net > >> Subject: RE: Populating a dropdown list with ENUM values... > >> > >> > >> G'day Scott: > >> > >> I wrote this function to do just what you're atfer: > >> You may need to mess with it for you're own needs - but go for your > >> life! > >> > >> //----function: "enum_select()" - automatically generate an HTML select > >> menu from a MySQL ENUM field > >> //----1). takes a table name: '$table' > >> //----2). a name for the menu '$name' > >> //----3). a CSS class > >> function enum_select($table,$name,$class) { > >> $sql = "SHOW COLUMNS FROM $table"; > >> $result = mysql_query($sql); > >> $select = "<select name=\"$name\" class=\"$class\">\n\t"; > >> while($myrow = mysql_fetch_row($result)){ > >> $enum_field = substr($myrow[1],0,4); > >> if($enum_field == "enum"){ > >> global $enum_field; > >> $enums = substr($myrow[1],5,-1); > >> $enums = ereg_replace("'","",$enums); > >> $enums = explode(",",$enums); > >> foreach($enums as $val) { > >> $select .= "<option > >> value=\"$val\">$val</option>\n\t"; > >> }//----end foreach > >> }//----end if > >> }//----end while > >> $select .= "\r</select>"; > >> return $select; > >> }//----end function > >> > >> > >> All the best. > >> Russ > >> > >> -- > >> PHP Database Mailing List (http://www.php.net/) > >> To unsubscribe, visit: http://www.php.net/unsub.php > > > >Matthias Steinböck >Email: grillen@abendstille.at >Web: http://www.abendstille.at > >Frühabendliches Webdesign. >------------------------------------------ >Im Übrigen sind wir der Meinung, dass >unsere Gesellschaft Gabel-diskriminierend >Löffel verwendet. Alle Macht den Gabeln! > > >-- >PHP Database Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php > > > > > >-- >PHP Database Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php