Divi WordPress Theme

PHP MySQL Example - PHP MySQL sample connection Tutorial

Topic: PHP MySQL Example - PHP MySQL sample connection Tutorial  (Read 5587 times)

Offline Kevin

  • Junior Guru
  • **
  • Posts: 72
  • iTrader: +4/-0
    • View Profile
PHP MySQL Example - PHP MySQL sample connection Tutorial
« on: August 19, 2008, 01:02:41 AM »
If you are facing trouble to connect to your MySQL database you can use the following code to check the database connection:
Code: [Select]
<?php
$dbhost 
'localhost';   // Your MySQL server host
$dbuser 'dbuser';         // MySQL database user
$dbpass 'password'// Password for MySQL database User

$conn mysql_connect($dbhost$dbuser$dbpass) or 
die (
'Error connecting to mysql');
$dbname 'database_name';
mysql_select_db($dbname);
?>

Regards,

Kevin
VPS Hosting - AccuWebHosting

Offline wilsondavid

  • Newbie
  • *
  • Posts: 5
  • iTrader: +0/-0
    • View Profile
Re: PHP MySQL Example - PHP MySQL sample connection Tutorial
« Reply #1 on: December 22, 2011, 05:52:05 PM »
PHP - MYSQL connection :

<?

$link = mysql_connect(" localhost "," root ","");

mysql_select_db("sample",$link);

$result=mysql_query(" SELECT * from employee;");

?>
Shopify Divi WordPress Theme
Tags:

Various Connection Strings to Connect to an Access DB

Started by TechBoard MS Access

Replies: 3
Views: 5960
Last post October 13, 2015, 09:54:54 AM
by jeffreykirwin
Manual Installation Tutorial for PHP 5 on IIS 5.1

Started by TechBoard Microsoft IIS

Replies: 0
Views: 5997
Last post August 29, 2007, 02:34:12 AM
by Tech
Enabling IIS 5.1 on Windows XP Pro Tutorial

Started by TechBoard Microsoft IIS

Replies: 0
Views: 5959
Last post September 30, 2007, 02:43:25 PM
by Tech
Apache Webserver - A quick tutorial for new Admins

Started by TechBoard Apache

Replies: 0
Views: 4583
Last post September 30, 2007, 03:19:18 PM
by Tech
CDONTS Sample script - ASP Sendmail script

Started by KailashBoard ASP

Replies: 0
Views: 8144
Last post November 30, 2008, 10:47:40 AM
by Kailash