I used the following code, but it doesn't work, and I get no errors.
$query = db_insert('taxonomy_index')->fields(array('nid', 'tid', 'sticky', 'created'));
$query->values(array(
'nid' => $node->nid,
'tid' => 53,
'sticky' => 0,
'created' => time(),
));
$query->execute();
dvm($query);
if (!$query) {
dvm($query);
}
The output of this code is the following.
$query = db_insert('taxonomy_index')
->fields(array('nid' => 27, 'tid' => 53, 'sticky' => 0, 'created' => time()))
->execute();
dvm($query);
if (!$query) {
dvm($query);
}
This code doesn't output any error; dvm($query)
outputs '0'
.
$row = new stdClass();
$row->nid = 27;
$row->tid = 55;
$row->created = time();
drupal_write_record('taxonomy_index', $row);
This gives the same result of the previous code.
$arr[] = 55;
db_query('INSERT INTO {taxonomy_index} VALUES (%d, %d, %d, %d)', 27, 55, 0, time());
It doesn't work; It outputs the following error message.
Recoverable fatal error: Argument 2 passed to db_query() must be of the type array, integer given, called in D:\OpenServer\domains\boobon\sites\all\modules\backup_bike\backup_bike.module on line 214 and defined в функции db_query() (строка 2342 в файле D:\OpenServer\domains\boobon\includes\database\database.inc).
I have installed the Ubercart module.