/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function duplicateRow($table,$primaryField,$primaryIDvalue) { // duplicate one record in a table // and return the id $fields = getCommaFields($table,$primaryField); $sql = "insert into $table ($fields) select $fields from $table where $primaryField='".mysql_real_escape($primaryIDvalue)."' limit 0,1"; }
URL: http://www.barattalo.it/2010/01/25/10-php-usefull-functions-for-mysql-stuff/