Monday, October 8, 2012

Test MySQL connection in php using xampp



XAMPP is a very easy to install Apache Distribution for Linux, Solaris, Windows and Mac OS X. The package includes the Apache web server, MySQL, PHP, Perl, a FTP server and phpMyAdmin.
XAMPP Web Site

Go to http://localhost/phpmyadmin/ after installing xampp
create database "test" under Database tab. Under "Users", check database username "root", host "localhost", password "no" for default

My default working directory is: C:\xampp\htdocs\xampp\
 Create a directory phptest, input the following script in test.php:
<?php
  
$db_host = "localhost";
$db_username = "root";
$db_pass = "";
$db_name = "test";

if(mysql_connect("$db_host","$db_username","$db_pass"))
{echo "connect to MySQL server ".$db_host." with username ".$db_username."<br />";}
else die ("could not connect to mysql");
if(mysql_select_db("$db_name"))
{echo "connect to dtabase ".$db_name;}
else die("no database");            
?>

Run
http://localhost/xampp/phptest/test.php

If everything is OK, the result should return:
connect to MySQL server localhost with username root
connect to dtabase test

9 comments:

  1. Superb information, as always. After reading this one I really got refreshing and fantastic feeling! This is also a great and encouraging post.
    PHP Training in Chennai
    PHP Course in Chennai

    ReplyDelete
    Replies
    1. Jiansen Lu'S Computing Blog: Test Mysql Connection In Php Using Xampp >>>>> Download Now

      >>>>> Download Full

      Jiansen Lu'S Computing Blog: Test Mysql Connection In Php Using Xampp >>>>> Download LINK

      >>>>> Download Now

      Jiansen Lu'S Computing Blog: Test Mysql Connection In Php Using Xampp >>>>> Download Full

      >>>>> Download LINK 0L

      Delete
  2. Excellent Blog, I have read all your blogs. Thanks for sharing important information. Such a nice post
    Best web designing institute in chennai
    Best web designing course in chennai

    ReplyDelete
  3. Online Front is a professional digital marketing company in Delhi. You can get the best digital marketing services by online front. We have an expert team of digital marketing who make the best strategy to promote your business through Google, Facebook, Instagram, and other social media platforms. We know it might be tough to achieve the target but not impossible. And our team proved! you can check our previous work with our previous client.

    Visit For More Info:-

    Website Development Company In Delhi
    Digital Marketing Company In Delhi
    Website Development Packages
    Website Designing company in delhi
    Social Media Management Packages
    Email Marketing Services

    Visit Our Partner’s Site:-

    Gas Stove Repair & Services in Delhi
    B2B Marketplace in Delhi
    Satta King

    ReplyDelete
  4. Jiansen Lu'S Computing Blog: Test Mysql Connection In Php Using Xampp >>>>> Download Now

    >>>>> Download Full

    Jiansen Lu'S Computing Blog: Test Mysql Connection In Php Using Xampp >>>>> Download LINK

    >>>>> Download Now

    Jiansen Lu'S Computing Blog: Test Mysql Connection In Php Using Xampp >>>>> Download Full

    >>>>> Download LINK

    ReplyDelete