Quote values heading to DB. Cast some ints.

git-svn-id: https://develop.svn.wordpress.org/trunk@5029 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2007-03-12 16:09:44 +00:00
parent 02f3720bfa
commit 71bbe5ffb4
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')");
}
}