I have added new text field in registration form using hook_user. but i could not insert into the database.
How to do that, where should i write insert query. I used following code.
function beep_user($op, &$edit, &$account, $category = NULL) {
if ($op == 'register' && $category == 'submit') {
// do stuff...
// using an explicit INSERT statement:
db_query("INSERT INTO {user_ip} (uid, ip) VALUES (2,'111.111.111')");
// using drupal_write_record():
drupal_write_record('users_ip');
// And this code
db_insert('user_ip')->fields(array('uid' => 2, 'ip' => '111.111.111'))->execute();
// And this
$sql = "INSERT INTO {users_ip} (uid,ip) VALUES (2,'".$_SERVER['REMOTE_ADDR']."')";
db_query($sql);
}
}
but still it's not working.
somebody help me please.
Comments
Comment #1
jacob.embree commentedThis question does not appear to have anything to do with Dirty Forms.