mysqli_select_db() expects parameter 1 to be mysqli on line 8

I Don't know what actually I should do and if there is something wrong somebody please correct it and give it thanks in advance

    $db_host = 'localhost';
    $db_user = 'root';
    $db_pass = '';
    $db_name = 'cms';

    $conn = mysqli_connect($db_host,$db_user,$db_pass) or die(mysql_error());



Use this:

$con = mysqli_connect($hostname,$user,$password,$database);

You don't need:


Your code will be:

$db_host = 'localhost';
$db_user = 'root';
$db_pass = '';
$db_name = 'cms';

$con = mysqli_connect($db_host,$db_user,$db_pass,$db_name);

Why you trying use longest way? Instead, try:

$con=mysqli_connect('localhost', 'root', '', 'cms');

Try this:

 mysqli_select_db($conn, $db_name);

Need Your Help

How much code do you tend to write before you test?


I have noted over the years, that I tend to write maybe a screen full of code, then test to make sure it does what it should.

Accessing SOAP Service with soap4r not able to access contents of returned objects

ruby soap wsdl soap4r

So I need to access this service from my rails app. I'm using soap4r to read the WSDL and dynamically generate methods for accessing the service.