View Single Post
Old 09-12-2009, 09:58   #40
punky
Gone
Alpha Bravo Charlie Champion
 
Join Date: Jun 2003
Age: 31
Posts: 14,760
punky has a golden aurapunky has a golden aura
punky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aura
Re: Any php coders out there?

Quote:
Originally Posted by Damien View Post
How would you suggest avoiding having a Php file for every possible operation? Seems messy too have a file for each update/delete and so on.
Well Apache doesn't care and if HM understands it fine then it doesn't really matter.

I've done a variety of patterns, it depends on the project. One idea is to perform a switch on the query string.

/events.php?do=add
/events.php?do=edit&id=55

then:

PHP Code:
switch($_GET['do'])
{

case 
'add'performAdd();
break;
case 
'delete'performDelete($_GET['id'])
break;
default:
//invalid operation
break;
}


Seomtimes you split it up per database or table/model (like in MVC). Sometimes you split it up by operation. If you have a lot of operations you can split it up logically byu directory. It depends on experience and the project.
punky is offline   Reply With Quote