Universal Update / Delete Script

Hey There -
I could use some suggestions / advice here. I have to create several
update and delete scripts for two different areas of a site. For
example "Update the News, Update an Event, Delete News, Delete Event"
and so on. Instead of writing 4 separate scripts that updates and /
or deletes records in MySQL, what would be the best approach in having
an 2 universal scripts that updates and another one that just deletes?

Does this make sense?

Here's a breakdown:
Events - Update / Delete (events table)
News - Update / Delete (news table)
_______________________
Craig Hoffman
iChat / AIM: mountain.dog
_______________________






--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Craig Hoffman [ Fr, 21 November 2008 16:46 ] [ ID #1978150 ]

Re: Universal Update / Delete Script

--------------090309040205080502040209
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Well, if you're using some good database layer, you can have for example
insert.php file with query template and give it some parameters.

$arr = array(
'field1' => 'value1',
'field2' => 'valuer2',
...
);

$query = layer::query('INSERT INTO [table]', $arr);

Then you will need just to prepare you're posted values for inserting
(remove submit button from POST array etc.). If you have you form inputs
named after fields in database, you should have no problems.


Craig Hoffman napsal(a):
> Hey There -
> I could use some suggestions / advice here. I have to create several
> update and delete scripts for two different areas of a site. For
> example "Update the News, Update an Event, Delete News, Delete Event"
> and so on. Instead of writing 4 separate scripts that updates and /
> or deletes records in MySQL, what would be the best approach in having
> an 2 universal scripts that updates and another one that just deletes?
>
> Does this make sense?
>
> Here's a breakdown:
> Events - Update / Delete (events table)
> News - Update / Delete (news table)
> _______________________
> Craig Hoffman
> iChat / AIM: mountain.dog
> _______________________
>
>
>
>
>
>

--

S pozdravem

Daniel Tlach
Freelance webdeveloper

Email: mail [at] danaketh.com
ICQ: 160914875
MSN: danaketh [at] hotmail.com
Jabber: danaketh [at] jabbim.cz


--------------090309040205080502040209--
danaketh [ Fr, 21 November 2008 18:31 ] [ ID #1978151 ]
PHP » gmane.comp.php.database » Universal Update / Delete Script

Vorheriges Thema: php5/oci8/oracle 11g1 insert doesn't work ..updated..sorry
Nächstes Thema: problem oci_connect solved..thanks to those involved