Quote values heading to DB. Cast some ints.

git-svn-id: http://svn.automattic.com/wordpress/trunk@5029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2007-03-12 16:09:44 +00:00
parent df9b4188da
commit 4bfbba990b
2 changed files with 7 additions and 4 deletions

View File

@ -469,9 +469,11 @@ function wp_set_link_cats($link_ID = 0, $link_categories = array()) {
if ($add_cats) {
foreach ($add_cats as $new_cat) {
$wpdb->query("
INSERT INTO $wpdb->link2cat (link_id, category_id)
VALUES ($link_ID, $new_cat)");
$new_cat = (int) $new_cat;
if ( !empty($new_cat) )
$wpdb->query("
INSERT INTO $wpdb->link2cat (link_id, category_id)
VALUES ('$link_ID', '$new_cat')");
}
}

View File

@ -802,10 +802,11 @@ function wp_set_post_categories($post_ID = 0, $post_categories = array()) {
if ($add_cats) {
foreach ($add_cats as $new_cat) {
$new_cat = (int) $new_cat;
if ( !empty($new_cat) )
$wpdb->query("
INSERT INTO $wpdb->post2cat (post_id, category_id)
VALUES ($post_ID, $new_cat)");
VALUES ('$post_ID', '$new_cat')");
}
}