How to add a record to a table that has a foreign key in mysql/php?

Good evening again for the second time that day,

I have a method it adds the hash key for token_user_id (FOREIGN KEY) user user_id (PRIMARY KEY)

Why can't I add to the database hash with the specified token_user_id (they coincide with the user_id) user cost 4,
what comes in method 4 is also an integer, the database also provide during account creation type int(255)

it gives an error:
integer: 4
SQLSTATE[HY000]: General error: 1366 Incorrect integer value: ':tuid' for column 'token_user_id' at row 1


$sql = "INSERT INTO user_tokens 
 (token_user_id, token_user_agent, token_token, token_created, token_expires) 
 VALUES (':tuid', 'ua', 'tt', 'tc', ':txpr')";

 echo $userid;

 $binder = array(
 ':tuid' => $userid, // here I have 4 in the database where a user is specified is also specified user_id -> 4
 'ua' => serialize($visitor->get_userspecs()),
 ':tt' => $userhash,
 'tc' => time(),
 ':txpr' => strtotime('+2 Days')
 );
April 4th 20 at 00:52
2 answers
April 4th 20 at 00:54
$binder = array(
':tuid' => intval($userid), // here I have 4 in the database where a user is specified is also specified user_id -> 4
'ua' => serialize($visitor->get_userspecs()),
':tt' => $userhash,
'tc' => time(),
':txpr' => strtotime('+2 Days')
);
tried already everything possible and just figure put and multiply nothing helps - abigail.Brown commented on April 4th 20 at 00:57
April 4th 20 at 00:56
You have in one place on this page is written :tuid, and the other is uid. This is normal behavior, or a typo?
code at different times I changed the keys, they thought of something to rewrite. and it still doesn't work. a sort of bastard wants to work and is why I don't understand. in the log above, he rewrites all the time label placeholders and what not clear. all the same - abigail.Brown commented on April 4th 20 at 00:59

Find more questions by tags PHPMySQL