Closed (duplicate)
Project:
Install Profile API (obsolete)
Version:
5.x-1.x-dev
Component:
crud.inc
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
3 Jul 2007 at 21:02 UTC
Updated:
10 Nov 2007 at 16:34 UTC
This function doesn't seem to work with D5.1. First problem is that {contact}.cid is an auto_increment field, so there is no reason to use db_next_id. Second, not sure why in the VALUES declaration, values are being equated... looks like VALUES is being treated like a function. So, I propose the following fix:
Change this:
function install_contact_add_category($category, $recipients, $reply = '', $weight = 0, $selected = 0) {
$cid = db_next_id("{contact}_cid");
db_query("INSERT INTO {contact} (cid, category, recipients, reply, weight, selected) VALUES (%d, category = '%s', recipients = '%s', reply = '%s', weight = %d, selected = %d)", $cid, $category, $recipients, $reply, $weight, $selected);
}
To This:
function install_contact_add_category($category, $recipients, $reply, $weight, $selected) {
db_query("INSERT INTO {contact} (category, recipients, reply, weight, selected) VALUES ('%s', '%s', '%s', %d, %d)", $category, $recipients, $reply, $weight, $selected);
}
Much simpler.
Comments
Comment #1
boris mann commentedProbably cut and paste errors. Thanks.
Comment #2
dmitrig01 commentedDupe of http://drupal.org/node/150998