Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,194,853 members, 7,956,212 topics. Date: Monday, 23 September 2024 at 07:54 AM |
Nairaland Forum / Science/Technology / Programming / Problem Trying To Connect To My Database (1121 Views)
I Need To Deal With My Database. / GURUS! I Need Urgent Help With Using Php To Connect To Xampp Mysql / Please How Do I Print This Data From MY Database. MYSQL, PHP (2) (3) (4)
Problem Trying To Connect To My Database by seunzone: 11:01pm On Oct 24, 2016 |
holla. Please if you're quite handy with PHP help out. see this code //create database $connection = mysqli_connect("localhost","root","" if (!$connection){ die("Database connection failed: " . mysql_error()); } //databas select code $db_select = mysqli_select_db("alm",$connection); if (!$db_select){ die("Database connection failed: " .mysql_error()); } ?> Its a php file, l'm trying to connect to a database named alm. my localhost password is null so thats not the problem. My browser gives the following error; Warning: mysqli_select_db() expects parameter 1 to be mysqli, string given in C:\wamp\www\alimi\databases.php on line 8 Database connection failed: |
Re: Problem Trying To Connect To My Database by Nobody: 11:06pm On Oct 24, 2016 |
Can solve it for a fee |
Re: Problem Trying To Connect To My Database by noordean(m): 11:27pm On Oct 24, 2016 |
seunzone:The order of ur arguments to mysqli_select_db() is wrong. $connection should come before db name. should be: mysqli_select_db($connection,"alm" It's shown clearly from the error msg. 1 Like |
Re: Problem Trying To Connect To My Database by ANTONINEUTRON(m): 12:04am On Oct 25, 2016 |
Forget That Mysqli_select_db() i.e cancel it. and use only $CONNECTION = mysqli_connect("host","username","password","databasename" i.e ur database name is within the mysqli_connect() |
Re: Problem Trying To Connect To My Database by Whytelyon(m): 6:41am On Oct 25, 2016 |
In this order.
|
Re: Problem Trying To Connect To My Database by noordean(m): 7:23am On Oct 25, 2016 |
ANTONINEUTRON: It can be outside. it depends on what he's trying to achieve. |
Re: Problem Trying To Connect To My Database by guru01(m): 7:56am On Oct 25, 2016 |
Noordean is right, mysqli resource is suppose to be the first parameter pass, while the other is dbname. |
Re: Problem Trying To Connect To My Database by paranorman(m): 11:30am On Oct 25, 2016 |
The mighty PDO.. . |
Re: Problem Trying To Connect To My Database by ANTONINEUTRON(m): 7:31pm On Oct 25, 2016 |
noordean:yea the 'USE' command i think?? |
Re: Problem Trying To Connect To My Database by ANTONINEUTRON(m): 7:31pm On Oct 25, 2016 |
noordean:yea the 'USE' command i think?? |
Re: Problem Trying To Connect To My Database by ANTONINEUTRON(m): 7:31pm On Oct 25, 2016 |
noordean:yea the 'USE' command i think?? |
(1) (Reply)
Need A Programming Tutor In Ibadan / Python Flask Help Please!!! / Programmers That Knows Golang And Blockchain Technology.
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 11 |