This topic is locked

Does PHPRunner support MySQL ENUM field?

5/11/2007 9:21:21 PM
PHPRunner General questions
T
thecolombian author

Running PHPRUNNER version 4.0
I have a schema with 1 table that has 30 fields, 15 of them have values set via ENUM.
Is there a way to add this functionality to PHPRunner.
I know in PHP you can do the following to select and display enum fields.
Any advice will be appreciated.
Thanks
JR
[codebox]<?php

// Function to Return All Possible ENUM Values for a Field

function getEnumValues($table, $field) {

$enum_array = array();

$query = 'SHOW COLUMNS FROM `' . $table . '` LIKE "' . $field . '"';

$result = mysql_query($query);

$row = mysql_fetch_row($result);

preg_match_all('/\'(.*?)\'/', $row[1], $enum_array);

if(!empty($enum_array[1])) {

// Shift array keys to match original enumerated index in MySQL (allows for use of index values instead of strings)

foreach($enum_array[1] as $mkey => $mval) $enum_fields[$mkey+1] = $mval;

return $enum_fields;

}

else return array(); // Return an empty array to avoid possible errors/warnings if array is passed to foreach() without first being checked with !empty().

}

?>[/codebox]

Alexey admin 5/14/2007

JR,
PHPRunner deals with ENUM fields the same way as with VARCHAR.

What exactly would you like to do with your ENUM fields ?

T
thecolombian author 5/15/2007

Basically I want the PHP form to pre-populate the fields from the enum fileds on the data base when you are trying to add data.
Right now I do not know how to make PHPRunner create a drop down menu from the the enum list stored on the data base.
Thanks you
JR

JR,

PHPRunner deals with ENUM fields the same way as with VARCHAR.

What exactly would you like to do with your ENUM fields ?

J
Jane 5/16/2007

Hi,
to set up field as dropdown box on the ADD page select Lookup wizard for this field on the "Edit as" settings dialog on the Visual Editor tab, choose List of values option and add your values manually.
We'll add support of ENUM field type in one of the next PHPRunner version.

501285 5/30/2007

Hi,

to set up field as dropdown box on the ADD page select Lookup wizard for this field on the "Edit as" settings dialog on the Visual Editor tab, choose List of values option and add your values manually.
We'll add support of ENUM field type in one of the next PHPRunner version.

501286 5/30/2007

Hi,

to set up field as dropdown box on the ADD page select Lookup wizard for this field on the "Edit as" settings dialog on the Visual Editor tab, choose List of values option and add your values manually.
We'll add support of ENUM field type in one of the next PHPRunner version.


Can you send me a print screen of how I get to "edit settings" once I have clicked on "Visual Editor"
>>on the "Edit as" settings dialog on the Visual Editor<<<<
I have been staring at the "add page" in the Visual Editor for some time now and do not see anything about "edit settings".
Thaniks!!!!!

J
Jane 5/31/2007

Just select add page and double click on the field on the Visual Editor tab.

501287 6/4/2007

Just select add page and double click on the field on the Visual Editor tab.


Thank you!! I did not realize you could click on the fields! That is really handy!!!

A
asawyer13DevClub member 12/7/2008

Jane,

Did support for enum end up making it into release 5?

Alan

Hi,

to set up field as dropdown box on the ADD page select Lookup wizard for this field on the "Edit as" settings dialog on the Visual Editor tab, choose List of values option and add your values manually.
We'll add support of ENUM field type in one of the next PHPRunner version.

J
Jane 12/8/2008

Alan,
no.

To set up field as dropdown box on the add page select Lookup wizard for this field on the "Edit as" settings dialog on the Visual Editor tab, choose List of values option and add your values manually. To open this dialog double click on the field.

A
asawyer13DevClub member 12/8/2008

Thanks,

Alan