I am doing a simple insert query using the db_insert call; no matter where I try this, I am getting the same result. Is this an error with the Drupal 7 DAL, or am I doing something wrong?
The script is not running multiple times, nor Does the query run multiple times; I am using the following in a custom PHP file to generate the data.
chdir('../'); define('DRUPAL_ROOT', getcwd()); require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); $query = db_insert("table_name") ->fields(array('nid' => 10, 'width' => 200, 'height' => 800)) ->execute();
I want to insert one record with the following data.
- nid: 10
- width: 200
- height: 800
Running this always results in 2 exact records in the database, without errors. Could it be anything to do with not currently having the table I am inserting into inside my modules .install file? Maybe Drupal is doing something daft because it can't find the database schema info?