SitePoint Sponsor

User Tag List

Results 1 to 21 of 21
  1. #1
    ǖber abstrakt's Avatar
    Join Date
    Dec 2001
    Location
    Earth
    Posts
    261
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Please see if you can point out the parse errors

    I am getting parse errors on the following lines, can someone please shed some light on why ?

    Thank you in advance.

    Code:
    $sql_email_check = mysql_query("SELECT email_address FROM users WHERE email_address='$email_address'"); 
    Code:
    $sql_username_check = mysql_query("SELECT username FROM users WHERE username='$username'");
    Code:
      $salt = "abchefghjkmnpqrstuvwxyz0123456789";
    (this last one "salt" is the seed for a random pass gen.)

  2. #2
    SitePoint Member CorySchop's Avatar
    Join Date
    Sep 2003
    Location
    Moncton NB, Canada
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    humm just a thought try setting your query equal to something firt.. then pass that into the query function

    Like so

    $query = "SELECT email_address FROM users WHERE email_address='$email_address'";

    then

    $query_result = mysql_query($query);

    try echoing out the query.. try running your result from your echo into an sql form.. I use an admin tool for this.

    Hope this helps

  3. #3
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you perhaps have an unterminated string prior to these lines of code?
    Jason Sweat ZCE - jsweat_php@yahoo.com
    Book: PHP Patterns
    Good Stuff: SimpleTest PHPUnit FireFox ADOdb YUI
    Detestable (adjective): software that isn't testable.

  4. #4
    ǖber abstrakt's Avatar
    Join Date
    Dec 2001
    Location
    Earth
    Posts
    261
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sweatje
    Do you perhaps have an unterminated string prior to these lines of code?
    Thank you for the reply, would it alert me if I did ? The first error I get is a parse error for the first line I quoted above.

  5. #5
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by abstrakt
    Thank you for the reply, would it alert me if I did ? The first error I get is a parse error for the first line I quoted above.
    consider the code:
    PHP Code:
    $foo "something\";
    $sql_email_check = mysql_query("SELECT email_address FROM users WHERE email_address='$email_address'"); 
    which you can see from the syntax highlighting will clearly be a PHP syntax error on your line of code becuase of the unterminated string constant.

  6. #6
    SitePoint Addict CeleronXL's Avatar
    Join Date
    Dec 2002
    Location
    United States of America
    Posts
    349
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Post code from before those lines.
    So hold me when I'm here
    Right me when I'm wrong
    Hold me when I'm scared
    Love me when I'm gone.

  7. #7
    ǖber abstrakt's Avatar
    Join Date
    Dec 2001
    Location
    Earth
    Posts
    261
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    include 'incl/db.php'
    // Define post fields into simple variables 
    $first_name $_POST['first_name']; 
    $last_name $_POST['last_name']; 
    $email_address $_POST['email_address']; 
    $username $_POST['username']; 
    $location $_POST['location']; 
    $age $_POST['age']; 
    $homepage $_POST['homepage']; 
    $icq $_POST['icq']; 
    $aim $_POST['aim']; 
    $yahoo $_POST['yahoo']; 
    $msn $_POST['msn']; 
    $fav_trick $_POST['fav_trick']; 
    $fav_pro $_POST['fav_pro']; 
    $skate_setup $_POST['skate_setup']; 

    /* Let's strip some slashes in case the user entered 
    any escaped characters. */ 
    $first_name stripslashes($first_name); 
    $last_name stripslashes($last_name); 
    $email_address stripslashes($email_address); 
    $username stripslashes($username); 
    $location stripslashes($location);
    $age stripslashes($age);
    $homepage stripslashes($homepage);
    $icq stripslashes($icq);
    $aim stripslashes($aim);
    $yahoo stripslashes($yahoo);
    $msn stripslashes($msn);
    $fav_trick stripslashes($fav_trick);
    $fav_pro stripslashes($fav_pro);
    $skate_setup stripslashes($skate_setup);


    /* Do some error checking on the form posted fields */ 
    if((!$first_name) || (!$last_name) || (!$email_address) || (!$username) || (!$location) || (!$age)){ 
    echo 
    'You did not submit the following required information! <br />'
    if(!
    $first_name){ 
    echo 
    "First Name is a required field. Please enter it below.<br />"

    if(!
    $last_name){ 
    echo 
    "Last Name is a required field. Please enter it below.<br />"

    if(!
    $email_address){ 
    echo 
    "Email Address is a required field. Please enter it below.<br />"

    if(!
    $username){ 
    echo 
    "Desired Username is a required field. Please enter it below.<br />";
    }
    if(!
    $location){ 
    echo 
    "Location is a required field. Please enter it below.<br />"
    }
    if(!
    $age){ 
    echo 
    "Age is a required field. Please enter it below.<br />"
    }
    "; 

    include 'join_form.html'; // Show the form again! 
    /* End the error checking and if everything is ok, we'll move on to 
    creating the user account */ 
    exit(); // if the error checking has failed, we'll exit the script! 

    Last edited by abstrakt; Oct 9, 2003 at 21:40.

  8. #8
    ǖber abstrakt's Avatar
    Join Date
    Dec 2001
    Location
    Earth
    Posts
    261
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There's also the db.php file, would it matter, assuming it would, here it is:

    Code:
    $db = mysql_connect("localhost","dbuser","dbpass") or die("Could not connect to the database !");
    mysql_select_db("database_name") or die("The database does not exist !");

  9. #9
    ǖber abstrakt's Avatar
    Join Date
    Dec 2001
    Location
    Earth
    Posts
    261
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    :'(

  10. #10
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can you change your [ code ] tags to [ php ] tags in post #7 to enable syntax highlighting?

  11. #11
    ǖber abstrakt's Avatar
    Join Date
    Dec 2001
    Location
    Earth
    Posts
    261
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sweatje
    can you change your [ code ] tags to [ php ] tags in post #7 to enable syntax highlighting?
    Done, thank you very much, I appreciate your time in helping me out !

  12. #12
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I do not see the lines you posted in #1 in #7. Are they the same script?

  13. #13
    SitePoint Addict CeleronXL's Avatar
    Join Date
    Dec 2002
    Location
    United States of America
    Posts
    349
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Find:
    PHP Code:
    if(!$age){
    echo 
    "Age is a required field. Please enter it below.<br />";
    }
    ";

    Replace with:

    PHP Code:
    if(!$age){
    echo 
    "Age is a required field. Please enter it below.<br />";
    }

    So hold me when I'm here
    Right me when I'm wrong
    Hold me when I'm scared
    Love me when I'm gone.

  14. #14
    ǖber abstrakt's Avatar
    Join Date
    Dec 2001
    Location
    Earth
    Posts
    261
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Still not working.

    Yes, it is the same script, the lines in post #1 come after the lines in the above script. I am still getting the parse error on the same lines.

    This is wacky, I bet it's something simple too. Grr.

  15. #15
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    CeleronXL found your unterminated string declaration. There is still something wrong after that?

  16. #16
    ǖber abstrakt's Avatar
    Join Date
    Dec 2001
    Location
    Earth
    Posts
    261
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sweatje
    CeleronXL found your unterminated string declaration. There is still something wrong after that?
    Yea, still getting parse errors for the same exact lines. WOuld MySQL 3.23 be the problem ?

    This stinks. :'(

  17. #17
    ǖber abstrakt's Avatar
    Join Date
    Dec 2001
    Location
    Earth
    Posts
    261
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dangit.

  18. #18
    ǖber abstrakt's Avatar
    Join Date
    Dec 2001
    Location
    Earth
    Posts
    261
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    bump

  19. #19
    SitePoint Member Viper78's Avatar
    Join Date
    Oct 2003
    Location
    Canada
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try this
    PHP Code:
    include 'incl/db.php'
    // Define post fields into simple variables 
    $first_name $_POST['first_name']; 
    $last_name $_POST['last_name']; 
    $email_address $_POST['email_address']; 
    $username $_POST['username']; 
    $location $_POST['location']; 
    $age $_POST['age']; 
    $homepage $_POST['homepage']; 
    $icq $_POST['icq']; 
    $aim $_POST['aim']; 
    $yahoo $_POST['yahoo']; 
    $msn $_POST['msn']; 
    $fav_trick $_POST['fav_trick']; 
    $fav_pro $_POST['fav_pro']; 
    $skate_setup $_POST['skate_setup']; 

    /* Let's strip some slashes in case the user entered 
    any escaped characters. */ 
    $first_name stripslashes($first_name); 
    $last_name stripslashes($last_name); 
    $email_address stripslashes($email_address); 
    $username stripslashes($username); 
    $location stripslashes($location);
    $age stripslashes($age);
    $homepage stripslashes($homepage);
    $icq stripslashes($icq);
    $aim stripslashes($aim);
    $yahoo stripslashes($yahoo);
    $msn stripslashes($msn);
    $fav_trick stripslashes($fav_trick);
    $fav_pro stripslashes($fav_pro);
    $skate_setup stripslashes($skate_setup);


    /* Do some error checking on the form posted fields */ 
    if((!$first_name) || (!$last_name) || (!$email_address) || (!$username) || (!$location) || (!$age)){ 
    echo 
    'You did not submit the following required information! <br />'
    if(!
    $first_name){ 
    echo 
    "First Name is a required field. Please enter it below.<br />"

    if(!
    $last_name){ 
    echo 
    "Last Name is a required field. Please enter it below.<br />"

    if(!
    $email_address){ 
    echo 
    "Email Address is a required field. Please enter it below.<br />"

    if(!
    $username){ 
    echo 
    "Desired Username is a required field. Please enter it below.<br />";
    }
    if(!
    $location){ 
    echo 
    "Location is a required field. Please enter it below.<br />"
    }
    if(!
    $age){ 
    echo 
    "Age is a required field. Please enter it below.<br />"
    }
    include 
    'join_form.html'// Show the form again! 
    exit();

    you had more } than {

    Hope this helps

    Viper

  20. #20
    ǖber abstrakt's Avatar
    Join Date
    Dec 2001
    Location
    Earth
    Posts
    261
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    YOU ARE THE MAN ! Thank you !

  21. #21
    SitePoint Member Viper78's Avatar
    Join Date
    Oct 2003
    Location
    Canada
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    your welcome glad to help.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •