Hey ppl. Well this is my first post on this forum! Lets get to the point... A few days ago I decided that I wanted a Login system for my site (www.clanph.net) using PHP to drive it. So I poped down to my local book store and bought a PHP book. Called: Dreamweaver MX: PHP Web Developemt. I made the appropriate pages. But ive come aross a problem on the create_users.php page. Everytime I try to view it I get a "parse error on line 47" Ive tried looking at link 47 and comparing it with the book and theres nothing wrong! but IE6 thinks there is!

Here is the code:

}
// Insert Data
$myquery = "INSERT INTO users ( firstName, lastName, username, password, "
line 47-> $myquery .= "status) VALUES ('$firstName', '$lastName', '$username', "
$myquery .= " '$password', '$status')";
$result = mysql_query($myquery, $mysql);
if (!$result)
{

www.clanph.net/admin/create_users.php to see the error for yourself! It does look wrong to me but I don't know where the error is! can someone pls help? thx.

    lines 46 & 47 miss semicolons.

      Shouldn't you end line 46 and 47 with a ; too?

      Y.

        Thx man! that seamed to fix it! but ive got another parse error on line 76! :mad:

        // check all form fields are filled in
          if (!check_form($form_data))
          {
            $error = "All form fields must be filled in";
        	return($error)
        line 76->  }
        

        need ya help again lol

          Lol,

          you forgot your ; again.

          After the return line.
          Always check the line before mentioned in the error if you didn't forget it.

          Y.

            Thx again! there are zilch parse errors now 😃

              You should set up some security, you don't want anybody to become an admin right 😃 Make sure that only people with admin status can see this page.

              Y.

                DAMN another fecking error!!! when I press the create user button i get this error: Fatal error: Call to undefined function: trim_data() in create_users.php on line 68

                 function verify_data($formdata)
                 {
                   // This function uses the functions in the include file,
                  // and uses them to validate various aspects of the form.
                  // If validation fails, it returns $error, the apporpriate error message
                  // If validation suceeds, return true
                  $error = "";
                line 68->  $form_data = trim_data($formdata);
                  $user = $form_data['username'];
                

                  there isn't a function called trim_data() unless you have defined one. try trim() instead.

                    Yet another error: Fatal error: Call to undefined function: check_form() in create_users.php on line 72

                    // check all form fields are filled in
                    line 72->  if (!check_form($form_data))
                      {
                        $error = "All form fields must be filled in";
                    	return($error);
                      }
                    

                    need help yet again
                    :rolleyes:

                      maybe try checking that book again for these functions, check_form and trim_data, as your script is currently not finding these functions.

                        Ok I got trim and check sorted. I looked at the include source. But I cant get the confirm password function to work! >_<

                        confirm password function:

                        <?php
                        function confirm_password($formdata, $password1, $password2)
                        {
                           // Check that two passwords given match
                           // $formdata = Form Data Array
                           // $password1 = Name of first password field
                           // $password2 = Name of second password field
                        
                           if ($formdata[$password1] === $formdata[$password2])
                             return true;
                           else
                             return false;
                        }	 
                        ?>
                        <?php
                        

                        This is the create_users.php version:

                        // check password and confirmation password match
                          if (!confirm_password($form_data, 'password', 'confirmpassword'))
                          {
                            $error = "Password and Confirm Password do not match";
                        	return($error);
                          }
                        

                        Any ideas to why the confirm function isnt working? thx.

                          Well, I'm not sure where $formdata[] comes from, but I would guess that the syntax should be $formdata['varname'], instead of $formdata[$varname].

                          Also, I can't remember what the === symbol means exactly, but I would try just a == .

                            Write a Reply...