Another One of Those T_DNUMBER Errors

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RSchrand
    New Member
    • Nov 2010
    • 5

    Another One of Those T_DNUMBER Errors

    First, I am stuck using GoDaddy because that's who my client went with. I'm almost thinking this is related to their address for the database hosting, but I would like confirmation on that.

    Having uploaded the database and then the site, when accessing the linked pages I get the following error message:

    Parse error: syntax error, unexpected T_DNUMBER in D:\Hosting\#### ##\html\Connect ions\saveFairgr ounds.php on line 9

    Here's the errant code:

    Code:
    $conn_saveFairgrounds.php = mysql_pconnect($hostname_xxxxxx.db.#####.hostedresource.com, $username_xxxxx, $password_xxxxxx) or trigger_error(mysql_error(),E_USER_ERROR);
    (Of course the places where there are x's and #'s have the actual db hosting name, username and password. In addition, these match the relevent lines of code prior to Line 9.)

    When I type the hostname into this line of code, I get a Syntax error on Line 1 (<?php ). When it's not there, the error goes away.

    Again, I think this is a GoDaddy thing. But no one there will help with this.

    Your help is greatly appreciated.

    btw: I notice when I preview this message there is a space showing between the s and o in hostedresource. That space is not in the file.
    Last edited by Markus; Nov 14 '10, 05:45 PM. Reason: Added [code][/code] tags
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    That period should not be in the variable name, the rest of your code also raises questions, but I'm not sure if that's just an effect of you editing it.

    Anyway, in future, please post the *full* relevant code, wrapped in [code] tags. That way we can look at the line number, find it in your code, and put 2 and 2 together, without having to worry about whether something strange in the code is just a side-effect of you modifying it. Of course, any sensitive data should be changed.

    Mark.

    Comment

    • RSchrand
      New Member
      • Nov 2010
      • 5

      #3
      OK. Thanks for the reply. But, just to make this work better, here's the entire code.

      Code:
      <?php
      # FileName="Connection_php_mysql.htm"
      # Type="MYSQL"
      # HTTP="true"
      $hostname_conn_saveFairgrounds = "xxxxx.db.#####.hostedresource.com";
      $database_conn_saveFairgrounds = "xxxxx";
      $username_conn_saveFairgrounds = "xxxxx";
      $password_conn_saveFairgrounds = "xxxxx";
      $conn_saveFairgrounds.php = mysql_pconnect($hostname_xxxxx.db.#####.hostedresource.com, $username_xxxxx, $password_xxxxxx) or trigger_error(mysql_error(),E_USER_ERROR); 
      ?>
      I, again, appreciate your time and your suggestions.

      Comment

      • code green
        Recognized Expert Top Contributor
        • Mar 2007
        • 1726

        #4
        You are setting variables and then not using them
        Code:
        $hostname_conn_saveFairgrounds = "xxxxx.db.#####.hostedresource.com"; 
        $database_conn_saveFairgrounds = "xxxxx"; 
        $username_conn_saveFairgrounds = "xxxxx"; 
        $password_conn_saveFairgrounds = "xxxxx"; 
        $conn_saveFairgrounds.php = mysql_pconnect($hostname_xxxxx.db.#####.hostedresource.com, $username_xxxxx, $password_xxxxxx);
        And you can't do this $hostname_xxxxx .db.#####.hoste dresource.com without quotes.
        I can't give an example because the code is too obscure.

        Comment

        • RSchrand
          New Member
          • Nov 2010
          • 5

          #5
          I don't understand why it's so obscure, but I'll look into it.

          I definitely appreciate your help.

          Comment

          • code green
            Recognized Expert Top Contributor
            • Mar 2007
            • 1726

            #6
            I suppose it should have been "too obscured".
            As Markus stated, it is very difficult to spot a syntax error when code is so heavily edited.
            (Surely you only need to protect username and password)
            And this is either completely wrong or so heavily edited you have confused yourself
            Code:
            $username_conn_saveFairgrounds = "xxxxx";  
            $password_conn_saveFairgrounds = "xxxxx"
            mysql_pconnect($hostname_xxxxx.db.#####.hostedresource.com, 
            $username_xxxxx, $password_xxxxxx);

            Comment

            • RSchrand
              New Member
              • Nov 2010
              • 5

              #7
              I actually had to obscure the sections I did. The username and the first part of the hostname (the part with the x's) are the same. There is a number that I can replace in the hostname (in the # spots), but I don't see that as much of an issue. In addition, the password is, of course, the password.

              What happens, and what makes me think it's a hosting issue is, when I paste the the hostname (which I copied/pasted from the hosting service)into the $hostname_ field on line 9, I get a syntax error on Line 1. It's that name that's causing the problems.

              Putting the $hostname_ identifier in quotations doesn't work, plugging a shortened version of the hostname in there doesn't help. Adding .php to the conn_saveFairgr ounds portion of Line 9 doesn't work. I truly believe it's the database's hostname.

              I have used this code on ten other sites and it's worked perfectly. Suffice it to say, they are on different hosts and the hostnames aren't 1/3 as convoluted as this saveFairgrounds one.

              I really appreciate your help. The responses pretty much let me know I'm not going overly crazy.

              Comment

              • Markus
                Recognized Expert Expert
                • Jun 2007
                • 6092

                #8
                I can't imagine why it would compile anywhere. This is invalid code on any PHP interpreter:

                Code:
                $conn_saveFairgrounds.php = mysql_pconnect($hostname_xxxxx.db.#####.hostedresource.com, $username_xxxxx, $password_xxxxxx);
                1. Variables should not contain any periods;
                2. No such $hostname_xxxxx variable;
                3. ##### is not a valid token;
                4. hostedresource is not a defined constant;
                5. same goes for com;
                6. No such $username_xxxxx variable;
                7. No such $password_xxxxx variable;
                Last edited by Markus; Nov 15 '10, 05:30 PM. Reason: Added info

                Comment

                • code green
                  Recognized Expert Top Contributor
                  • Mar 2007
                  • 1726

                  #9
                  Maybe it is in the hostname, but the error is a syntax error and this is one big syntax error
                  Code:
                  $conn__saveFairgrounds.php = mysql_pconnect($hostname_xxxxxx.db.#####.hostedresource.com, $username_xxxxx, $password_xxxxxx) or trigger_error(mysql_error(),E_USER_ERROR);
                  Both Markus and I have told you this.
                  But I can't work out what it is meant to be.
                  Putting the $hostname_ identifier in quotations doesn't work
                  What does this mean?
                  Does it mean you no longer get a syntax error but there is no connection?

                  Comment

                  • RSchrand
                    New Member
                    • Nov 2010
                    • 5

                    #10
                    Hey guys -

                    I appreciate your help. I literally copied the what the hosting service gave me and they verified that this was the code. I knew that the variable was wrong ($hostname_xxxx x.db...etc.). I really needed verification, which you have given me.

                    This code has worked perfectly on other sites, so I knew it had to be something on the host's end and they way they are naming the db's when uploaded. Again, this is verbatim from the hosting service.

                    I sincerely thank you for your help. I'll be transferring hosting of this site to another company.

                    Comment

                    • Markus
                      Recognized Expert Expert
                      • Jun 2007
                      • 6092

                      #11
                      The hosting company gave you that code? Jump ship!

                      My advice: get yourself a VPS (they're cheap these days) and have ultimate control of your server.

                      Comment

                      Working...