Re: 'Code Snippets' you couldn't live without

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

 



> snippets they couldn't live without when working on a PHP project. IE, the
> kind of re-usable bits and pieces that make your life a lot easier.

I hate always having to write queries for inserting and updating a db.
 With this I can just name the form objects the same names as the
table fields and I'm done.

function insert($table, $fld, $val){
       $query = "INSERT INTO $table (%s) VALUES (%s)";
       $query = sprintf($query, implode(",", $fld), implode(",", $val));
       $result = mssql_query($query) or die;
}	


alex hogan

-- 
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