markkanning Posted November 7, 2006 Share Posted November 7, 2006 I'm building a site administration backend for a client that will involve multiple insert, update and delete scripts for different tables of a database. I'm trying to avoid having more pages in the admin site than the actual website itself. How does one have one file that includes the database connection, all the variable declarations and all the queries and form processing on one file? It would be nice if I could have the forms involved have an action that references the same processing file and possibly a reference to a function in that file that does the inserting, updating or deleting.Any thoughts?Mark Quote Link to comment Share on other sites More sharing options...
fenway Posted November 7, 2006 Share Posted November 7, 2006 Well, you can simply "include" a connection.php file with the necessary credentials. And sure, there's no reason why you can't have a central processing script, but it's not always better that way. Quote Link to comment Share on other sites More sharing options...
markkanning Posted November 7, 2006 Author Share Posted November 7, 2006 But, that's the question. HOW does one put that central processing script together? I understand how to put the scripts into functions, but how does one reference those functions in the form action?Mark Quote Link to comment Share on other sites More sharing options...
fenway Posted November 7, 2006 Share Posted November 7, 2006 Just use hidden INPUT field to pass a set of parameters to your scripts. Presumably, since you're in an admin area, you don't have to worry too much about tainting. Quote Link to comment Share on other sites More sharing options...
markkanning Posted November 7, 2006 Author Share Posted November 7, 2006 Here's another scenerio on that same idea(and please forgive the somewhat novice smell that's coming off of the screen): could I at least include multiple, say, include queries for different tables in one processing script? It seems to me, as long as they're dealing with differently named variables, one wouldn't accidently insert data into the wrong table. Is that right? Or is it not good to be querying mutliple tables at once?Mark Quote Link to comment Share on other sites More sharing options...
fenway Posted November 8, 2006 Share Posted November 8, 2006 I'm not sure exactly what you're getting at -- once you have a control path establishing, keeping the scripts together vs. seperate is just housekeeping. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.