01-30-2009, 04:15 PM
|
#80 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
I found this kinda cool function on the net, which would allow you to insert content easier. It's good if you have long queries(which I'm sure we will have later on).
Transforms this:
PHP Code:
$sql = "INSERT INTO wp_comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content, comment_approved, comment_agent, comment_type, comment_parent, user_id) VALUES ('$comment_post_ID', '$comment_author', '$comment_author_email', '$comment_author_url', '$comment_author_IP', '$comment_date', '$comment_date_gmt', '$comment_content', '$comment_approved', '$comment_agent', '$comment_type', '$comment_parent', '$user_id')";
$db->exeQuery($sql);
into this:
PHP Code:
$sql_data = array('comment_post_ID' => $comment_post_ID, 'comment_author' => $comment_author, 'comment_author_email' => $comment_author_email, // some comments here 'comment_author_url' => $comment_author_url, 'comment_author_IP' => $comment_author_IP, // IP of the author 'comment_date' => $comment_date, // Comment date 'comment_date_gmt' => $comment_date_gmt, 'comment_content' => $comment_content, 'comment_approved' => $comment_approved, 'comment_agent' => $comment_agent, 'comment_type' => $comment_type, 'comment_parent' => $comment_parent, 'user_id' => $user_id);
$db->insert('wp_comments', $sql_data);
Implement?
Function found here:
http://www.bitrepository.com/web-pro...cient-way.html
__________________
|
|
|
|