Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2005
    Posts
    1

    Unhappy Unanswered: Parse error: parse error unexpected $ Please help!

    "Parse error: parse error, unexpected $ in [address] on line 38" => Is the error I am getting.

    The php code I am using I will post below:

    PHP Code:
    <?php if (isset($_GET['usname'])): // User wants to add a joke 
     
    if (isset($_GET['psw'])): // User wants to add a joke 
     
    if (isset($_GET['firstname'])): // User wants to add a joke 
     
    if (isset($_GET['lastname'])): // User wants to add a joke 
     
    if (isset($_GET['email'])): // User wants to add a joke 
     
    if (isset($_GET['extranotes'])): // User wants to add a joke 

     // Connect to the database server 
     
    $dbcnx = @mysql_connect('localhost''USERNAME4''PSW5'); 
     if (!
    $dbcnx) { 
       exit(
    '<p>The server is unable to connect to the ' 
           
    'database server at this time.</p>'); 
     } 

     
    // Select the jokes database 
     
    if (!@mysql_select_db('DBNAME')) { 
       exit(
    '<p>The server is unable to locate the Users ' 
           
    'database at this time.</p>'); 
     }

     
    // If a joke has been submitted, 
     // add it to the database. 
     
    if (isset($_POST['usname'])) { 
       
    $sql="INSERT INTO TABLE_NAME SET 
           Username='
    $usname',  
           Password='
    $psw',
           Real_Name_First='
    $firstname',
           Real_Name_Last='
    $lastname',
           Email='
    $email',
           Extra_Notes='
    $extranotes";

       if (@
    mysql_query($sql)) { 
         echo 
    '<p>Your account request will be revised; if you receive an account, an e-mail will be sent to the address you specified.</p>'
       } else { 
         echo 
    '<p>An error occurred while submitting your request: ' 
             
    mysql_error() . '</p>'
       } 
    }
    What the heck - line 38 is the very last little squiggly thingy - what is going on? I am using a form from different *.htm page to submit the values. Any help would be appreciated - thanks!
    Last edited by The_Dude45; 01-22-05 at 22:44.

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    that error meesage usually indicates a missing closing block or semicolon
    Having a quick look at your code it looks like you may be missing the "?>" to indicate the end of the php block
    HTH

  3. #3
    Join Date
    Sep 2003
    Location
    So. Cal. USA
    Posts
    142
    Howdy! This looks suspicious to me....

    // If a joke has been submitted,
    // add it to the database.
    if (isset($_POST['usname'])) {
    ***$sql="INSERT INTO TABLE_NAME SET
    *******Username='$usname',**
    *******Password='$psw',
    *******Real_Name_First='$firstname',
    *******Real_Name_Last='$lastname',
    *******Email='$email',
    *******Extra_Notes='$extranotes";

    Maybe...

    *******Extra_Notes='$extranotes'";

    Initially, I thought it was because you were using $variables inside single quotes and I didn't think you could do that but I can't test that at the moment. I thought something like

    $fruit = "apple";
    print ("$fruit ");
    print ('$fruit');

    would output...
    apple $fruit

    Anyway, I hope 1 of those helps...
    --ST

  4. #4
    Join Date
    Feb 2005
    Posts
    1
    Quote Originally Posted by The_Dude45
    "Parse error: parse error, unexpected $ in [address] on line 38" => Is the error I am getting.

    The php code I am using I will post below:

    PHP Code:

     
    // If a joke has been submitted, 
     // add it to the database. 
     
    if (isset($_POST['usname'])) { 
       
    $sql="INSERT INTO TABLE_NAME SET 
           Username='
    $usname',  
           Password='
    $psw',
           Real_Name_First='
    $firstname',
           Real_Name_Last='
    $lastname',
           Email='
    $email',
           Extra_Notes='
    $extranotes";   <-- (') and then (") is wrong I think 
    I'm looking for the answer in a similar situation. But in your issue, one major thing pops out: You have mixed punctuation on the Extra_Notes line.

    It'd be nice if you put your solution up if you found one.

    Thanks!

Posting Permissions

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