Anyone can tell me.How many ways are there to connect PHP with MYSQL and give me code also pls

Recommended Answers

All 2 Replies

2 ways but I'm not sure if they both refer to the same type of SQL databases. The first one is:

$linkID = @mysql_connect($dbhost,$accountname,$password)
	or die("Could not connect to MySQL server");
@mysql_select_db($database) or die("Could not select database");

And the second is MySQLI and I think might be as follows:

$linkID = @mysqli_connect($dbhost,$accountname,$password,$database)
	or die("Could not connect to MySQL server");
@mysqli_select_db($linkID,$database) or die("Could not select database");

The first one i think is more common.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.