It seems that mysqli_insert_id is not working
I have been trying to make this work for several hours and cannot do anything. The code I am using is below. I am working on a phpbb page that explains template and sql query setup.
$sql_query = 'INSERT INTO ' . rosters . ' ' . $db->sql_build_array('INSERT', $sql_rost);
$result_rost = $db->sql_query($sql_query);
$roster_last = $mysqli->insert_id;
$template->assign_block_vars('some_block', array(
'ROSTER' => $roster_last,
'TEST' =>'test'
));
$db->sql_freeresult($result_rost);
The insert request works because I see a new record in the database, and on the template I used TEST to make sure that this block is displayed and what it is.
Also, I have not used
mysqli_insert_id($link)
because I am connected to the database with a different piece of code, so I don't want to replicate the database connection. Without $link
I get an error that mysqli_insert_id
another parameter is expected.
+3
source to share