PHP MySQL unable to get rows from query -


brand new php , i'm going through few tutorials @ moment. have created login.php file has hostname, database, username, , password. test1.php page requires login.php file , attempts connect it.

i select database, attempt query, , store results. here have far:

<?php   // test1.php     require_once 'login.php';     $db_server = mysqli_connect($db_hostname, $db_username, $db_password);      if (!$db_server) die("unable connect mysql: " . mysql_error());      mysqli_select_db($db_server, $db_database)         or die("unable select database: " . mysql_error());      $query = "select * classics";     $result = mysqli_query($db_server, $query);      if (!$result) die ("database access failed: " . mysql_error());      $rows = mysql_num_rows($result); ?> 

the error getting says:

mysql_num_rows() expects parameter 1 resource, object given on line 15 

line 15 is:

$rows = mysql_num_rows($result); 

what resource looking pass mysql_num_rows()?

the mysql_num_rows() expects parameter 1 resource occurs when statement wrong, classics table not exist.

and use mysqli instead of mysql


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -