I have the following piece of code that runs down to the last line indicating that it can't use the db petdb.
- Code: Select all
<?php
//connect to database server
$link = mysqli_connect('localhost', $INFO['user_name'], $INFO['user_pswd']);
//print'hello';
//$link = mysqli_connect('localhost','davidkindy', 'dk&hk');
//print'hello1';
if (!$link) die('Could not connect to Database Server: '.mysql_error());
// make petdb the current db
$db_selected = mysqli_select_db('petdb', $link);
if (!$db_selected) die ('Can\'t use database petdb : '.mysqli_error());
?>
I have this code that provides the login detail.
- Code: Select all
<?php
$INFO['user_name'] = 'davidkindy';
$INFO['user_pswd'] = 'dk&hk';
?>
In the accounts overview, I have created an account davidkindy with hostname as localhost and %. There is a DB called petdb created.