Asi me quedo... no quería hacerla asi porque suponia que habria alguna forma mas simple o sin recurrir a una nueva consulta.
Código PHP:
function create_member()
{
$sql = 'INSERT INTO coordenadas (a1, a2, a3, a4, a5, a6, a7, a8, a9, b1, b2, b3, b4, b5, b6, b7, b8, b9, c1, c2, c3, c4, c5, c6, c7, c8, c9, d1, d2, d3, d4, d5, d6, d7, d8, d9, e1, e2, e3, e4, e5, e6, e7, e8, e9, f1, f2, f3, f4, f5, f6, f7, f8, f9, g1, g2, g3, g4, g5, g6, g7, g8, g9, h1, h2, h3, h4, h5, h6, h7, h8, h9, i1, i2, i3, i4, i5, i6, i7, i8, i9) VALUES (';
for($i = 1; $i <= 81; $i++){
$rand = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f');
$r = $rand[rand(0,15)].$rand[rand(0,15)];
$sql.= '"'.$r.'", ';
}
$sql.= 'remplazar)'; //esto es solo para poder remplazar la ultima "," que no deberia ir
$sql = str_replace(", remplazar)", ")", $sql);
$this->db->query($sql);
$this->db->select_max('id_coordenada');
$id_coordenada = $this->db->get('coordenadas');
foreach ($id_coordenada->result() as $row) {
$id = $row->id_coordenada;
}
$new_member_insert_data = array(
'nombre' => $this->input->post('first_name'),
'apellido' => $this->input->post('last_name'),
'email' => $this->input->post('email_address'),
'usuario' => md5($this->input->post('username').$this->input->post('sal')),
'pass' => md5($this->input->post('password')),
'id_coordenada' => $id
);
$insert = $this->db->insert('usuarios', $new_member_insert_data);
return $insert;
}