Re: Create PHP form from MySQL table structure
| From: | Bassel Safadi | Date: | Sun, 21 Dec 2008 17:43:55 +0000 |
| Subject: | Re: Create PHP form from MySQL table structure | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-284925@lists.php.net to get a copy of this message | ||
On Sun, Dec 21, 2008 at 7:24 PM, tedd <tedd.sperling@gmail.com> wrote:
> At 10:35 AM +0000 12/21/08, R B MacGregor wrote:
>
>> Hi folks
>>
>> Anybody got any recommendations for a utility which would create a quick
>> head
>> start by creating the php/html code for a basic form using the field
>> structure
>> of a MySQL table ?
>>
>> Thanks for any suggestions.
>>
>> --
>> Ronnie MacGregor
>> Scotland
>>
>> Ronnie at
>> dBASEdeveloper
>> dot co dot uk
>>
>
>
> Interesting.
>
> I am sure that one can write a script to find all the fields in a table and
> create a form from that. However, I don't know of any utility that does
> that.
>
> Hope that helps,
>
> tedd
I wrote a class for my upcoming opensource cms ( aikicms ) , that can handle
an array of added value description of a db table, and convert it into forms
for inserting, and editing.
the array looks like this:
$insertArray= array(
"tablename" => "aiki_something",
"pkey" => "id",
"selection1" => "cityid:NAME:aikiads_cities:id:cities", //values form
other table: aikiads_cities
"textinput1" => "name:NAME",
"textblock" => "bodytext:NAME",
"upload" =>
"filename:NAME:jpg:resize:640|n_|75|s_:/home/paintings:/home/paintings/s_",
"staticselect" => "staticname:NAME:letters",
"staticselect" => "staticname:NAME:date_years:2002-2008",
"imagefolderupload" =>
"filedname:NAME:jpg:resize:640|n_|75|s_:/home/paintings:/home/paintings/s_",
);
the values of this method instead of just walking throw each filed and
putting a text block for it, that the class can automatically generate
upload forms with image resizing and stored procedures of linked tables
inside mysql..
I think you'll understand what I mean by just looking to the array, the code
will be available soon under GPL,
if anyone is interesting I can send the beta class source for further
improvement,
maybe adding a function that can find each field of a table and Hey that's
a text filed just add:
"textinput1" => "name:NAME",
then the class will build the form for you