0

hi i am attempting to change my connection from mysql to mysqli so far i have gone through all the files in the script and replaced mysql with mysql and i went to check what id done so far and i got the following error can anyone help in this ty jan x

Warning: mysqli_select_db() expects parameter 1 to be mysqli, string given in /home/jktempla/public_html/Escort/config/db_connect.php on line 6

Warning: mysqli_errno() expects exactly 1 parameter, 0 given in /home/jktempla/public_html/Escort/config/db_connect.php on line 6

This is the code for that section in the db_connection.php

$conn       = mysqli_connect(DBHOST,DBUSER,DBPASS) or die(mysqli_errno());
$dn         = mysqli_select_db(DBNAME,$conn) or die(mysqli_errno());

$row        = mysqli_fetch_array(mysqli_query("select * from settings where id = '1' "));
$site_name  = trim(stripslashes($row['site_name']));
$email      = trim($row['email']);
$keyword    = trim(stripslashes($row['keyword']));
$description= trim(stripslashes($row['description']));
$logo       = trim($row['logo']);
$copyright  = trim(stripslashes($row['copyright']));

And heres the database file

<?php
define ("DBHOST","localhost");
define ("DBUSER","******");
define ("DBPASS","******");
define ("DBNAME","*****");


/*define ("DBUSER","root");
define ("DBPASS","");
define ("DBNAME","date_demo");*/

define ("DBPREFIX","");
define ("CHAR_SET","utf8");
define ("CACHEDIR","");


?>

Edited by pritaeas: Moved.

2
Contributors
1
Reply
37
Views
2 Years
Discussion Span
Last Post by diafol
1

If you read the php manual on procedural mysqli, you'll find the connection object, or more correctly, "the link identifier" (usually denoted by $link) is the first parameter in the functions.

http://php.net/manual/en/mysqli.select-db.php

Edited by diafol

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.