[thelist] PHP tip
Dan Horning
dan at dwc.to
Tue Feb 4 12:04:01 CST 2003
|||-----Original Message-----
|||Subject: [thelist] PHP tip
|||
|||
|||I wanted to post a tip, something I use for iserting records
|||into a database
|||with PHP. Pretty basic stuff, but it may help the beginners.
|||
|||When inserting records into a database from PHP and an HTML
|||form, ensure the
|||names of the form fields correspond to the names of columns
|||in your table,
|||then you can use this code to quicly build an INSERT string:
|||
||| $insert = "INSERT INTO ".$tablename."(";
||| $insert .= implode(",",$columns).") VALUES
|||(\"".implode("\",\"",$values)."\")";
|||where $tablename is the name of your table, $columns is an
|||array of column
I'd be cautious of this tip b/c you open some vulnerabilities into your
database structure..
Just a thought
More information about the thelist
mailing list