phpmyadmin connection

Discussion in 'Scripts, 3rd Party Apps, and Programming' started by stasx10b, Jun 27, 2012.

  1. stasx10b

    stasx10b New Member

    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    i try to connect with phpmyadmin with string given below

    mysql_connect('localhost',root','');

    so its does't connect so wht is connection string for x10hosting.com...?

    pls frnds solve me
     
  2. misson

    misson Community Paragon Community Support

    Messages:
    2,572
    Likes Received:
    72
    Trophy Points:
    48
    If you're trying to connect to the MySQL server on X10, there's no way you have access to the root MySQL account. Use your own database account.

    A failed connection should produce an error; what is it?

    On X10, phpMyAdmin is already installed in cPanel. If you're trying to install your own copy, you don't need to.

    If instead you're writing your own script and write "phpmyadmin" instead of "MySQL" (two entirely different things), the mysql extension is outdated and on its way to deprecation. Instead, use PDO, which has many useful improvements, such as prepared statements and support for the Traversable interface, so you can loop over results with foreach.
     
    Last edited: Jun 27, 2012
  3. cozynew

    cozynew New Member

    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    <?php


    $host = "yourhost";
    $user = "your_user";
    $password = "your_user";
    $db_name = "db_name";


    //Array to store validation errors
    $errmsg_arr = array();

    //Validation error flag
    $errflag = false;


    $connect = mysql_connect($host,$user,$password);


    if (!$connect){
    die('could not connect:'.mysql_error());
    }
    $db_selected=mysql_select_db($db_name);
    if(!$db_selected){
    die('cant use '.$dbhost.':'.mysql_error());
    }
    ?>
     
  4. misson

    misson Community Paragon Community Support

    Messages:
    2,572
    Likes Received:
    72
    Trophy Points:
    48
    Code without context isn't very helpful. Code using outdated (the mysql extension) and poor practices (or die, outputting errors to non-admin users instead of logging them) is worse than unhelpful.
     

Share This Page