doubledee Posted March 19, 2012 Share Posted March 19, 2012 When I run this Prepared Statement... // Build query. $q2 = "INSERT INTO member(email, activation_code, salt, hash, first_name, username, register_ip, register_hostname, location, created_on) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, NOW())"; // Prepare statement. $stmt2 = mysqli_prepare($dbc, $q2); // Bind variables to query. mysqli_stmt_bind_param($stmt2, 'sssssssss', $email, $activationCode, $salt, $hash, $firstName, $username, $ip, $hostName, $location); // Execute query. mysqli_stmt_execute($stmt2); // Capture New ID. $_SESSION['memberID'] = mysql_insert_id(); I am getting this error... Warning: mysql_insert_id() [function.mysql-insert-id]: A link to the server could not be established in /Users/user1/Documents/DEV/++htdocs/05_Debbie/members/create_account.php on line 269 What am I doing wrong? Debbie Quote Link to comment https://forums.phpfreaks.com/topic/259229-problem-with-mysql_insert_id/ Share on other sites More sharing options...
scootstah Posted March 19, 2012 Share Posted March 19, 2012 You can't use the mysql extension in conjunction with the mysqli extension. You need to do mysqli_insert_id($dbc); Quote Link to comment https://forums.phpfreaks.com/topic/259229-problem-with-mysql_insert_id/#findComment-1328897 Share on other sites More sharing options...
doubledee Posted March 19, 2012 Author Share Posted March 19, 2012 You can't use the mysql extension in conjunction with the mysqli extension. You need to do mysqli_insert_id($dbc); Why do you have $dbc in the parentheses? Debbie Quote Link to comment https://forums.phpfreaks.com/topic/259229-problem-with-mysql_insert_id/#findComment-1328911 Share on other sites More sharing options...
scootstah Posted March 19, 2012 Share Posted March 19, 2012 Procedural stylemixed mysqli_insert_id ( mysqli $link ) LinkProcedural style only: A link identifier returned by mysqli_connect() or mysqli_init() Quote Link to comment https://forums.phpfreaks.com/topic/259229-problem-with-mysql_insert_id/#findComment-1328913 Share on other sites More sharing options...
doubledee Posted March 19, 2012 Author Share Posted March 19, 2012 Procedural stylemixed mysqli_insert_id ( mysqli $link ) LinkProcedural style only: A link identifier returned by mysqli_connect() or mysqli_init() Okay, I missed that. Thanks! Debbie Quote Link to comment https://forums.phpfreaks.com/topic/259229-problem-with-mysql_insert_id/#findComment-1328917 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.