Our blog
PHP Generated SQL
If you find yourself laboriously building SQL queries by typing each field = 'value' statement... think again.
Imagine this:
-
-
$insert_elsewhere_sql = "INSERT INTO other_table SET ";
-
-
foreach($s as $k=>$v){
-
$insert_elsewhere_sql .= "$k = '$v', ";
-
}
-
This will generate a valid SQL insert statement with all of your field, value pairs set up.
Time saver or what?
More Reading:
One Comments
|
but when I post a form data, there is a button and submit in the array , should replace it. |
RSS Feed
sinbao
October 22nd, 2009