Results 1 to 13 of 13

Thread: PHP query

  1. #1
    3 Star Lounger
    Join Date
    May 2003
    Location
    Mid-Cheshire, England
    Posts
    275
    Thanks
    1
    Thanked 3 Times in 3 Posts

    PHP query

    I have a simple self registration PHP script (21lines) that I am testing. It fails with a parsing error at line 15 .
    As my PHP knowledge is nil is anyone able to help me to get this working? If so I will post the script and error details.

  2. #2
    5 Star Lounger
    Join Date
    Apr 2003
    Location
    Hampshire, United Kingdom
    Posts
    602
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PHP query

    I know a bit of PHP; I'm happy to help if I can.
    Waggers
    If at first you do succeed, you've probably missed something.

  3. #3
    3 Star Lounger
    Join Date
    May 2003
    Location
    Mid-Cheshire, England
    Posts
    275
    Thanks
    1
    Thanked 3 Times in 3 Posts

    Re: PHP query

    Thank you for your response. As my introduction to PHP I am using the scripts for registration, authentication and forgot password from the tutorial at the URL:
    http://www.developertutorials.com/tutorial...0531/page2.html

    On the host server I have created a database with a table (tbl_login) that has three fields. loginid, password & email. In my site (FP2003) I have a page registration.htm with a form (not FP's) created from the sample HTML from the same tutorial. I also have a file register.php again based upon the sample PHP from the tutorial.

    When I register on-line an error message is displayed:
    Parse error: parse error, unexpected ',' in /home/domainname/domains/mydomainname.co.uk/public_html/register.php on line 15

    I have not changed line 15* that reads:
    $sql="INSERT INTO tbl_login (loginid, password and email) VALUES (".$loginid.

  4. #4
    5 Star Lounger
    Join Date
    Apr 2003
    Location
    Hampshire, United Kingdom
    Posts
    602
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PHP query

    Hmm - I can't see anything in that line that would cause the error shown (a comma in the wrong place) but that line of code can be simplified. I suggest replacing it with the following:

    $sql ="INSERT INTO tbl_login (loginid, password, email) VALUES ($loginid, $password, $email)
    Waggers
    If at first you do succeed, you've probably missed something.

  5. #5
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: PHP query

    Hi Malcolm

    Easiest thing to do is delete it along with the corresponding closing tags at the bottom of the file just before </body>

    I have a feeling you are using Frontpage and it is doing its usual and chucking in loads of extra code. If you don't fancy that try and get rid of all the tags using find and replace
    Jerry

  6. #6
    5 Star Lounger
    Join Date
    Apr 2003
    Location
    Hampshire, United Kingdom
    Posts
    602
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PHP query

    Ok, I've got it now. On line 63, the double-quote at the end of the line isn't actually a double-quote - PHP isn't recognising it as such. Changing that character to a real double-quote (just delete the existing one and type a new one) should solve the problem.

    The screenshot below shows my view of the code - notice the offending quote is in green when all the others are orange.
    Attached Images Attached Images
    Waggers
    If at first you do succeed, you&#39;ve probably missed something.

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: PHP query

    It's a "curly quote". This can happen if you edit code in Microsoft Word - one of the default AutoCorrect settings is to change quotes to curly quotes as you enter them.

  8. #8
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: PHP query

    ...and hence my comment about Frontpage....the autocorrect option is available in that too. Frontpage and Word are very , very similar in their HTML coding being sister products <img src=/S/cool.gif border=0 alt=cool width=15 height=15>
    Jerry

  9. #9
    3 Star Lounger
    Join Date
    May 2003
    Location
    Mid-Cheshire, England
    Posts
    275
    Thanks
    1
    Thanked 3 Times in 3 Posts

    Re: PHP query

    Thank you Jerry. I realised after I had sent register.php as an attachment that something was amiss. I had forgotten to protect the PHP code with the opening and closing remarks (the less than symbol should follow?) <% and %>. From previous experience FrontPage will not modify or add to a script so remarked.

    So I have amended my register.php and deleted all the FP dross. Progress on the implementation of this script is on hold for the time being but I will report back probably tomorrow.

    In the meantime my thanks to you and the other contributors - as always I am very grateful.

  10. #10
    3 Star Lounger
    Join Date
    May 2003
    Location
    Mid-Cheshire, England
    Posts
    275
    Thanks
    1
    Thanked 3 Times in 3 Posts

    Re: PHP query

    As I used Notepad in copying and pasting the original script from the tutorial from where I found it on-line I plead not guilty m'lud to using Word. <img src=/S/innocent.gif border=0 alt=innocent width=20 height=20>

  11. #11
    3 Star Lounger
    Join Date
    May 2003
    Location
    Mid-Cheshire, England
    Posts
    275
    Thanks
    1
    Thanked 3 Times in 3 Posts

    Re: PHP query

    Thank you very much for spotting that error. I'll make the change and report back - probably tomorrow.

  12. #12
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: PHP query

    Just for future reference, the <% and %> are "ASP-style" opening and closing tags for a block of script. If I recall correctly, PHP accepts them in lieu of its own <? and ?> tags.

  13. #13
    3 Star Lounger
    Join Date
    May 2003
    Location
    Mid-Cheshire, England
    Posts
    275
    Thanks
    1
    Thanked 3 Times in 3 Posts

    Re: PHP query

    Now when register php is run there is a different error this time in the HTML immediately after the PHP script:
    Parse error: parse error, unexpected T_LNUMBER in /home/mewalker/domains/mewalker.co.uk/public_html/membersarea/register.php on line 71

    Line 71:
    <table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td>

    I am attaching a copy of the register.php file in case that may show where the problem is.

    BTW - I like your site - neat and workmanlike. I have looked at Joomla! but it's very hard for a lazy old dog to learn new tricks!

Posting Permissions

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