Switch to full style
:read: Start PHP with us. Includes topics to help you in php
Post a reply

Selecting a Database in php

Sun Oct 26, 2008 7:00 pm

Select database by name in mysql from php
Code:
<?php
  $host
="host";
  
$uname="root";
  
$pass="password";
  
  
$connectionmysql_connect ($host$uname$pass);
  
  if (!
$connection) {
     die (
"A connection to the server could not be established!"); 
  }
  
  
$result=mysql_select_db ("codemiles");
  
  if (! 
$result) {
     die (
"database could not be selected");
  }
     
  echo 
"Database codemiles is ready for use.";
?>




Post a reply
  Related Posts  to : Selecting a Database in php
 Selecting a Domain Name at the Time of Registration     -  
 selecting a record randomly from table     -  
 Draw Bezier Curve and selecting the points with mouse click     -  
 2 different database     -  
 information about database     -  
 List all database in php     -  
 database connection     -  
 Persist in DataBase with AspectJ (AOP)     -  
 Login using jsp,Servlets and Database following MVC     -  
 Delete data from database by ID in php     -  

Topic Tags

PHP Database