How do I connect to an online MySQL database using PHP? -
i testing website offline xampp. php code connects , works local mysql database (i.e. 'localhost' or '127.0.0.1'). wish conduct tests using online mysql database. trying use phpmyadmin demo server error when trying connect server. changed 'db_host' '192.168.30.23' (which seems demo server ip address). missing something?
here snippet of code:
<?php define('db_name', 'ears'); define('db_user', 'root'); define('db_password', ''); define('db_host', '192.168.30.23'); $link = mysql_connect(db_host, db_user, db_password); if (!$link) { die('could not connect: ' . mysql_error()); } $db_selected = mysql_select_db(db_name, $link); if (!$db_selected) { die('can\'t use ' . db_name . ': ' . mysql_error()); } ?> thank in advance.
the phpmyadmin mysql demo server not available test script. google "public access mysql server" maybe find one.
Comments
Post a Comment