• PHP query

    Author
    Topic
    #438431

    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.

    Viewing 0 reply threads
    Author
    Replies
    • #1045411

      I know a bit of PHP; I’m happy to help if I can.

      • #1045414

        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%5B/url%5D

        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.

        • #1045415

          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)

          • #1045422

            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:

            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!

            • #1045425

              Hi Malcolm

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

              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

            • #1045449

              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?) . 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.

            • #1045499

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

            • #1045430

              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.

            • #1045436

              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.

            • #1045437

              …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 cool

            • #1045451

              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. innocent

            • #1045454

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

    Viewing 0 reply threads
    Reply To: PHP query

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: