Php with Mysql connection

Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
Watch
Impact
0
Hi,
I am looking for connection of PHP with mysql.
can any body send me coding of simple connection.
How to connect mysql.

Thanks...
 
Last edited by a moderator:
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
3
Close
Before you can access data in a database, you must create a connection to the database.
In PHP, this is done with the mysql_connect () function.
Syntax:
<?php
$con = mysql_connect(""localhost"",""peter"",""abc123"");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

// some code
?>?>
 
0
Close
PHP:
$dbname 	= '';
$dbuser 	= '';
$dbpass 	= '';
$dbhost 	= 'localhost';

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or exit(mysql_error());
mysql_select_db($dbname, $conn) or exit(mysql_error());
 
0
Close
Appraise.net

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back