Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • drunkenphd Friend
    #194284

    Hi,
    Actually I am trying to create some php form to extract data from database.

    How should I connect to database?

    I am trying :

    $db = JFactory::getDbo();

    $query = $db->getQuery(true);

    but no result.

    How can I access to jatc_university_j32 database and to its tables?

    I tried even
    [PHP]
    $db_hostname = ‘localhost’;
    $db_username = ‘root’;
    $db_password = ”;
    $db_database = ‘jatc_university_j32’;

    // Database Connection String
    $con = mysql_connect($db_hostname, $db_username, $db_password);
    if (!$con) {
    die(‘Could not connect: ‘ . mysql_error());
    }

    mysql_select_db($db_database, $con);
    [/PHP]

    unsuccessfully

    Ninja Lead Moderator
    #520785

    You can refer to this link Selecting data using JDatabase. Hope it helps.

Viewing 2 posts - 1 through 2 (of 2 total)

This topic contains 2 replies, has 2 voices, and was last updated by  Ninja Lead 10 years, 9 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum