Re: Custom function for inserting values into MySQL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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=" ?php
> echo $resultRow['user_id'] ? " ).
>
> I suppose I am still in the phase of learning efficiency, and perhaps
> trying to 'get out it' by writing functions that I can just call and
> pass parameters instead of fully learning the core concepts.
>
> I just think functions are so damn cool :)
>
>
>     I'll echo what the others have said about the parameters.  For me
>     personally, if I am passing more than three parameters (sometimes even
>     three) I rethink my function.  I'm not sure what you envision
>     using this
>     function for, but the approach I use for forms and databases is always
>     arrays.  I get an array from my forms, I insert that array into the
>     database, and of course I fetch arrays out of the database.  These are
>     all indexed the same with the index as the field name of the table so
>     it's easy.
>
>
>     --
>     Thanks!
>     -Shawn
>     http://www.spidean.com
>
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux