RE: [PHP] Custom function for inserting values into MySQL

2009-11-05 Thread Daevid Vincent
-Original Message- From: Shawn McKenzie [mailto:nos...@mckenzies.net] Sent: Thursday, November 05, 2009 6:14 AM To: Daevid Vincent Cc: 'Allen McCabe'; 'PHP General' Subject: Re: [PHP] Custom function for inserting values into MySQL Daevid Vincent wrote: -Original

Re: [PHP] Custom function for inserting values into MySQL

2009-11-04 Thread Shawn McKenzie
In your example, I would name my form inputs similar to name =data[user_id]. Then you just pass the $_POST['data'] array to your function. -Shawn Allen McCabe wrote: You raise some good points. I always name my input fields after the entity names ( eg. input type=hidden name =user_id value=

Re: [PHP] Custom function for inserting values into MySQL

2009-11-04 Thread Nathan Rixham
Shawn McKenzie wrote: Allen McCabe wrote: Do you see any major hangups or screwups on first glance? And is my fear of trying this out on my database unfounded? Does this even seem that useful? in all honesty.. loads of screwups - don't try it out on your database ultimately if it isn't

RE: [PHP] Custom function for inserting values into MySQL

2009-11-04 Thread Daevid Vincent
-Original Message- From: Shawn McKenzie [mailto:nos...@mckenzies.net] Sent: Wednesday, November 04, 2009 6:20 AM To: Allen McCabe; PHP General Subject: Re: [PHP] Custom function for inserting values into MySQL In your example, I would name my form inputs similar to name =data

Re: [PHP] Custom function for inserting values into MySQL

2009-11-03 Thread Shawn McKenzie
Allen McCabe wrote: Okay friends, I have been wondering about writing a simple function that will help me with my MySQL inserting. Not because I need to save time and space, but because I wanted to. I wrote a function for inserting 10 values (I have not been able to come up with an idea how

RE: [PHP] Custom function for inserting values into MySQL

2009-11-02 Thread Daevid Vincent
Do you see any major hangups or screwups on first glance? Yes. There is so much wrong with this I don't even know where to begin... This function takes 22 parameters: #1 is the table name, #2-21 are the row names and the values, and #22 is the integar string. Dude. Seriously? TWENTY TWO

Re: [PHP] Custom function for inserting values into MySQL

2009-11-02 Thread Phpster
I would take a look at some of the frameworks like codeignter to see how they do things. But like Davied mentioned a simpler way to handle the passing into the function would be Function save($table, $data) Where data is an array of key value pairs which takes your 22 parameters down