SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 42 of 42
  1. #26
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Ah ah, good.

    So, next step then.

    Place the following in the script, edit the $database settings (hostname, username, password, schema) at the top accordingly and upload.

    PHP Code:
    <?php
    error_reporting
    (-1);
    ini_set('display_errors'true);

    /*
      Edit these
    */
    $database = array(
      
    'hostname'  => 'localhost',
      
    'username'  => 'anthony',
      
    'password'  => 'super-secret',
      
    'schema'    => 'my_cms'
    );

    $conn mysql_connect(
      
    $database['hostname'],
      
    $database['username'],
      
    $database['password']
    );

    if(
    false === is_resource($conn)){
      echo 
    'Cannot connect to database: ' mysql_error() ;
      exit;
    }

    if(
    false === mysql_select_db($database['schema'], $conn)){
      echo 
    'Cannot select schema: ' mysql_error() ;
      exit;
    }
    ?>
    <html>
      <head>
        <title>Test</title>
      </head>
      <body>
        <h1>
          Connected successfully!
        </h1>
        <p>
          <?php printf("MySQL server version: %s"mysql_get_server_info($conn)); ?>
        </p>
      </body>
    </html>
    What do we get now?
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  2. #27
    SitePoint Member
    Join Date
    Oct 2010
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it doesn't seem to be returning anything

  3. #28
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Are you using 'localhost' as the hostname? If so, try changing it to '127.0.0.1' and give that a go.

    Very strange.
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  4. #29
    SitePoint Member
    Join Date
    Oct 2010
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    afraid i'm still not getting anything...

  5. #30
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    You're still getting a denied message?

    If it hasn't beaten you into submission yet, can you post the output of this script please?

    PHP Code:
    <?php
    error_reporting
    (-1);
    ini_set('display_errors'true);
    ?>
    <h3>
      Available extensions
    </h3>
    <ul>
      <?php foreach(get_loaded_extensions() as $extension): ?>
        <li>
          <?php echo $extension?>
        </li>
      <?php endforeach; ?>
    </ul>
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  6. #31
    SitePoint Member
    Join Date
    Oct 2010
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ha , I probably would have been but I need to try and work out if the issue lays at our door or if it's the IT company who need to fix something.

    Like I say - very grateful for your help on this.

    This is what the script outputs:

    Available extensions

    * date
    * libxml
    * openssl
    * pcre
    * zlib
    * bz2
    * calendar
    * ctype
    * hash
    * filter
    * ftp
    * gettext
    * gmp
    * session
    * iconv
    * pcntl
    * readline
    * Reflection
    * standard
    * shmop
    * SimpleXML
    * SPL
    * sockets
    * exif
    * tokenizer
    * xml
    * cgi-fcgi
    * imagick
    * bcmath
    * curl
    * dbase
    * dom
    * gd
    * imap
    * json
    * mbstring
    * mcrypt
    * mysql
    * mysqli
    * PDO
    * pdo_mysql
    * pdo_sqlite
    * soap
    * SQLite
    * wddx
    * xmlreader
    * xmlwriter
    * xsl
    * zip
    * ionCube Loader
    * Zend Optimizer

  7. #32
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Ok, let's try using MySQLi then instead as a last ditch attempt.

    PHP Code:
    <?php
    error_reporting
    (-1);
    ini_set('display_errors'true);

    /*
      Edit these
    */
    $database = array(
      
    'hostname'  => 'localhost',
      
    'username'  => 'anthony',
      
    'password'  => 'super-secret',
      
    'schema'    => 'my_cms'
    );

    $conn mysqli_connect(
      
    $database['hostname'],
      
    $database['username'],
      
    $database['password'],
      
    $database['schema']
    );

    if(
    false === ($conn instanceof MySQLi)){
      echo 
    'Cannot connect to database: ' mysqli_connect_error() ;
      exit;
    }
    ?>
    <html>
      <head>
        <title>Test</title>
      </head>
      <body>
        <h1>
          Connected successfully!
        </h1>
        <p>
          <?php printf('MySQL server version: %s'mysqli_get_server_info($conn)); ?>
        </p>
      </body>
    </html>
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  8. #33
    SitePoint Member
    Join Date
    Oct 2010
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    urgh - getting :

    Warning: mysqli_connect() [function.mysqli-connect]: (28000/1045): Access denied for user '***'@'localhost' (using password: YES) in /data/www/vhosts/***/***/***/second_homes_edit.php on line 20
    Cannot connect to database: Access denied for user '***'@'localhost' (using password: YES)

    same password etc as else where, I don't use the schema in the other config file though

  9. #34
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Yay, this is good - progress... Kinda.

    So, you're saying the host, username, password and schema that you're using are definitely correct? The error message suggests otherwise.

    Anthony.
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  10. #35
    SitePoint Member
    Join Date
    Oct 2010
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    everything apart from the schema is definitely ok.

    The schema I assume is essentially the db name, which if it is - should be correct...

    Sorry to ask for clarification on this but wanting to be certain

  11. #36
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Are you saying you can connect successfully, with the same credentials, using a different script? Yeah, the schema is database name.
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  12. #37
    SitePoint Member
    Join Date
    Oct 2010
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy

    well.. yes. The front end still works fine and the content of the front end is all
    content generated from the database.

    All the files essentially start with this include:

    PHP Code:
    <?php

    $con 
    mysql_connect("localhost","***","***");
    mysql_select_db("***"$con);

    ?>
    What's even stranger is that I can still edit certain other things through the cms

  13. #38
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Then I have no idea, I'm out.

    Maybe another member can help and/or offer some more advice?
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  14. #39
    SitePoint Member
    Join Date
    Oct 2010
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    great no problem - your help and advice was much appreciated.

    I think the problem here is with coniguration of the database. I will let you know once concluded - hopefully soon ; )

  15. #40
    SitePoint Wizard rguy84's Avatar
    Join Date
    Sep 2005
    Location
    Durham, NC
    Posts
    1,659
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    cali make a new file, have it only have as its contents.
    PHP Code:
    <?php  

    $link 
    mysqli_connect('localhost''fake_user''my_password''my_db');

    if (!
    $link) {
        die(
    'Connect Error: ' mysqli_connect_error());
    }
    ?>
    Ryan B | My Blog | Twitter

  16. #41
    SitePoint Member
    Join Date
    Oct 2010
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Ryan,

    thanks for your response, the IT company are checking the site today so have asked me not to change anything.

    Will try tomorrow if no joy.

  17. #42
    SitePoint Wizard rguy84's Avatar
    Join Date
    Sep 2005
    Location
    Durham, NC
    Posts
    1,659
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Hi Cali,

    I cannot speak for hosts. My host, you have to create a hostname for your database, so mydb.example.com, and you use that vs localhost for your host.
    Ryan B | My Blog | Twitter


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
  •