Warning: mysqli_query() expects at least 2 parameters
Posted: 19 May 2017, 13:55
I did turn a php script to mysqli but getting two errors:
Code:
line 26 is
my second error is the same
Code:
line 178 is
Code: Select all
Warning: mysqli_select_db() expects exactly 2 parameters, 1 given in /home/u790012824/public_html/Message/comments/db.php on line 26
Code: Select all
$db_hostname = "mysql.hostinger.nl"; //usually "localhost be default"
$db_username = "u790012824_gebru"; //your user name
$db_pass = "123456"; //the password for your user
$db_name = "u790012824_datab"; //the name of the database
/*MYSQL DATABASE CONNECTION/ TRACKING FUNCTIONS
--------------------------------------*/
// connect to database
$dbh = mysqli_connect ($db_hostname, $db_username, $db_pass) or die ('I cannot connect to the database because: ' . mysql_error());
mysqli_select_db ($db_name);
?>
Code: Select all
mysqli_select_db ($db_name);
Code: Select all
Warning: mysqli_query() expects at least 2 parameters, 1 given in /home/u790012824/public_html/Message/comments/inc_rate.php on line 178
Code: Select all
function getComments($tutid){
//fetch all comments from database where the tutorial number is the one you are asking for
$results = mysqli_query("SELECT * FROM comments WHERE qazi_id='$tutid' ORDER BY id DESC") or die(mysql_error());
//find the number of comments
$commentNum = mysqli_num_rows($results);
Code: Select all
$results = mysqli_query("SELECT * FROM comments WHERE qazi_id='$tutid' ORDER BY id DESC") or die(mysql_error());