Question

Ok I creating an application that needs to query records from my remote database. I am logged into phpmyadmin and I need to connect to this from my new PHP application. I have the cpanel access and the phpmyadmin tab. Is there something i can do to get the info needed to do this

$connection = mysql_connect(DB_HOST,DB_USER,DB_PASS,true);
mysql_select_db(DATABASE, $connection);
Was it helpful?

Solution

In the Databases section of cpanel, click on the icon labeled "MySQL Databases". There you can create databases and users.

The hostname was probably provided in your welcome email, along with your FTP access. Anyway, it should appear at the top of your phpMyAdmin page, under the label "Server:"

OTHER TIPS

First of all:

Your remote database needs to be accessible by tcp/ip.

Second:

<?php

    //connect to db
    mysql_connect (DB_HOST, DB_USER, DB_PASSWORD);
    mysql_select_db (DB_NAME);

    $strSQL = "SELECT col1,col2 FROM "  . DB_NAME . "." . "tbl1";

    $obj = mysql_query ($strSQL, $objMySQL_Read);  
?>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top