View Single Post
Old 11-23-2007, 12:54 PM   #1 (permalink)
Tanax
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default register function

What's wrong with it? :S:S

php Code:
public function user_register($user_name, $user_pass, $user_email, $user_firstname, $user_surname,
                                        $user_country, $user_location, $user_age, $user_access) {
           
            $sql = sprintf("    INSERT INTO
                                    `%s`
                                SET
                                    `%s` = '%s',
                                    `%s` = '%s',
                                    `%s` = '%s',
                                    `%s` = '%s',
                                    `%s` = '%d',
                                    `%s` = '%s',
                                    `%s` = '%s',
                                    `%s` = '%s',
                                    `%s` = '%s,
                                    `%s` = '%s'"
,
                                   
                                    $this->db->table['users'],
                                    $this->db->col['user_name'],
                                    $user_name,
                                    $this->db->col['user_pass'],
                                    md5($user_pass),
                                    $this->db->col['user_email'],
                                    $user_email,
                                    $this->db->col['user_firstname'],
                                    $user_firstname,
                                    $this->db->col['user_access'],
                                    $user_access,
                                    $this->db->col['user_surname'],
                                    $user_surname,
                                    $this->db->col['user_country'],
                                    $user_country,
                                    $this->db->col['user_location'],
                                    $user_location,
                                    $this->db->col['user_registered'],
                                    $this->now(),
                                    $this->db->col['user_age'],
                                    $user_age);
                                   
            $query = $this->db->query($sql);
           
            if(!$query) {
               
                return false;
               
            }
           
            return true;
           
        }

php Code:
if($error == 0) {
               
                if($tanaxia['user']->user_register($user_name, $user_pass, $user_email, $user_firstname, $user_surname,
                                                $user_country, $user_location, $user_age, '0')) {
                                                       
                   
                    echo 'Successfully registered!';                               
                                                       
                }
               
                else {
                   
                    echo '<font color="red">Something went wrong!</font><br />';
                   
                }
               
            }

Gives me "Something went wrong!" all the time I try to register :S
Tanax is offline  
Reply With Quote