Hi!
I wish to add the RegID from my "users" table to new records on 5 other tables' RegID after successful user registration. This is for the purpose of auto generating new records in the 5 tables associated with the same RegID.
My users table fields are RegID (Primary), userID, password, username and email.
My code is as follows:
function AfterSuccessfulRegistration($userdata, $pageObject)
{
global $conn;
$str = "select RegID from users where userID='".$_SESSION["userID"]."'";
$rs = db_exec($str,$conn);
$data = db_fetch_array($rs);
$datains = $data["RegID"];
$strSQLInsert1 = "insert into applicant (RegID) values ($datains)";
db_exec($strSQLInsert1,$conn);
}
I got this error:
Technical information
Error type 256
Error description Column count doesn't match value count at row 1
URL localhost/admit/register.php?
Error file C:\xampp\htdocs\admit\connections\MySQLiConnection.php
Error line 142
SQL query insert into applicant (RegID) values ()
Any help will be appreciated!!