Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,194,755 members, 7,955,877 topics. Date: Sunday, 22 September 2024 at 05:37 PM |
Nairaland Forum / Science/Technology / Programming / How Do I Connect To Mysql! (686 Views)
Help With Image Uploading To Mysql Database + Like System / Creating A Group Chat With Html/javascript/php/mysql For Beginners / I Changed My Password From Myphpadmin And Can No Longer Connect To Mysql Server (2) (3) (4)
How Do I Connect To Mysql! by emmanuelatas(m): 5:43am On May 01, 2015 |
I'm gradually learning php and mysql and it has been a problem connecting to mysql with the mysql_connect(). How do I connect to a database name "test" and table name "members". Help of out. Thanks for your input. |
Re: How Do I Connect To Mysql! by Nobody: 6:05am On May 01, 2015 |
emmanuelatas: Mysql_connect("localhost", "database username", "databasepassword"]; Mysql_select_db("test"]; |
Re: How Do I Connect To Mysql! by umaryusuf(m): 6:45am On May 01, 2015 |
You should have posted the code u hv written so far, the php version u are using. There several ways to achieve this;- For latest version of MySQLi (improved): <?php NOTE ----- This "MySQL" extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQL extension should be used. |
Re: How Do I Connect To Mysql! by FRInteractives: 9:02am On May 01, 2015 |
Here's how to create a mysql database connection using PDO <?php $dsn = 'mysql:dbname=testdb;host=127. 0.0.1'; $user = 'dbuser'; $password = 'dbpass'; try { $dbh = new PDO ($dsn, $user, $password); } catch (PDOException $e) { echo 'Connection failed: ' . $e- >getMessage(); } ?> 1 Like |
(1) (Reply)
Hello / Admission In Western European Ukraine National University. / Help! My Twitter Stopped Receiving My Blog Post After I Changed Domain Despite
(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. 9 |