Hi
I am trying to setup a seperate member registration form for IPB 1.3. Unfortunately, IPB's table structure of mysql doesn't increment the member ID automatically. So, in their registration form, they increment it manually. This is what they have:
PHP Code:
$DB->query("SELECT MAX(id) as new_id FROM ibf_members");
$r = $DB->fetch_row();
$member_id = $r['new_id'] + 1;
$member = array(
'id' => $member_id,
'name' => $in_username,
'password' => $in_password,
'email' => $in_email,
'mgroup' => $mem_group,
'posts' => 0,
'avatar' => 'noavatar',
'joined' => time(),
'ip_address' => $ibforums->input['IP_ADDRESS'],
'time_offset' => $ibforums->vars['time_offset'],
'allow_admin_mails' => 1,
'view_sigs' => 1,
'email_pm' => 1,
'view_img' => 1,
'view_avs' => 1,
'restrict_post' => 0,
'view_pop' => 1,
'vdirs' => "in:Inbox|sent:Sent Items",
'msg_total' => 0,
'new_msg' => 0,
'coppa_user' => $coppa,
'language' => $ibforums->vars['default_language'],
);
When I try to put it into my form I get the error "Call to a member function on a non-object" on line 19.
Here is what I have for my form:
PHP Code:
<?php
// Include the Mysql Config file (config.php)
include '../config.php';
// Connect to Mysql
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
mysql_select_db($dbname);
//Fetch data submitted from index.php form
$tableprefix = $_POST['tableprefix'];
//+--------------------------------------------
//| Find the highest member id, and increment it
//| auto_increment not used for guest id 0 val.
//+--------------------------------------------
$query = "SELECT MAX(id) as new_id FROM `".$tableprefix."_members`";
$r = $query->fetch_row();
$member_id = $r['new_id'] + 1;
// Insert into Mysql Database:
$query = "INSERT INTO `".$tableprefix."_members` (*query here-whatever it may be*)";
mysql_query($query) or die("Query failed: " . mysql_error());
// Show alert when data inserted to Mysql
echo "<script language=javascript>alert('*popup box message here-whatever it may be*'); window.location = '../index.html'; </script>";
// Close connection to Mysql
mysql_close($conn);
?>
It seems to be the row:
PHP Code:
$r = $query->fetch_row();
..and the $r causing the error. I cannot find what $r is in the IPB registration handler. So I am wondering if there is a way to work around it?
I am new to PHP so don't understand a lot.

I hope you have all the info needed. I am battling to get the member_id auto-incremented.
Thanks!