Skip to content

TechXcel.com - provides technical excellence...

Narrow screen resolution Wide screen resolution Increase font size Decrease font size Default font size default color orange color green color
You are here: Home arrow PHP arrow PHP Database Integration With MySQL
PHP Database Integration With MySQL PDF Print E-mail
(7 votes)
The Article - php
Written by Chetankumar Akarte   
Wednesday, 07 March 2007
Article Index
PHP Database Integration With MySQL
Create New Database
Select MySQl Database
Adding Data to Table
Retrive Data
Error Handing
Source Code

Select MySQL Database :

Now, we have established the connection with MySQL, and creates database user and table visitor. To work with the database, it must select. To select any MySQL database, PHP provides the mysql_select_db() function. It requires the database name which is to be selected and the link to database. Link is optional and if that is omitted, then the identifier returned from the last connection to server will be assumed as link.

Code 3: dbselect.php
<html>
 <head>
  <title>Server test Page </title>
 </head>
 <body>
  <p>Selecting  MySQL Database.</p>
  <?php
   $link = mysql_connect("mysql_host", "mysql_user", "mysql_password") or die("Could not connect : " . mysql_error());
   print "Connected successfully<p>";
   $DB = "user";
   mysql_select_db($DB) or die ("Database $DB not select.." . mysql_error());
   print "Successfully select the Database: $DB ";
  ?>
 </body>
</html>

The dbselect.php produces output as shown in Output-3.

Output 3 :- dbselect.php
Selecting MySQL Database.
Connected successfully
Successfully select the Database: user



Last Updated ( Tuesday, 13 March 2007 )
 

Who's Online

User Login

PayPal Donation

Enter Amount:

Syndicate

TechXcel's Friends

Tutorials Garden
Wicolorz
pixel2life

Text Link Add

Statistics

Members: 276
News: 60
Web Links: 6
Visitors: 348343

Google Seach

Google AdSense

TechXcel Referrals

TechXcel's Sponcer...