Databases| SQL| MySQL| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
 
 


 

PHP SQL Select

                         

PHP SQL Select is used to execute mysql select query in the php application. The PHP SQL Select uses mysql_select_db () function that set the active MySQL database. The function returns true on successful connection, or False on failure of connection. To perform SQL Select query in PHP, we must create a database connection between the PHP and MySQL.

Understand with Example

This example illustrates how to execute mysql select query in the php application. In the previous example we have already execute many more select query for retrieving data from database but in this example we show the use of  mysql_select_db function in php application. The sql_select.php starts with <? php and end with />. The <?php enclosed the con variable assigned the value of mysql_connect () function that accept the local host, user and pass. The die () script part will be executed in case of connection failure corresponding to specific print message on browser. The mysql_select_db () function accept parameter database and connection.

database : This is used to specifies the name of database to be select.

connection : This specifies the MySQL connection. If it is not specified, the last connection opened by mysql_connect () is used.

Source Code of sql_select.php 

<?php
  $user="root";
  $pass="root";
  $dbname="test";
  $con = mysql_connect("localhost", $user, $passor 

         die("Connection Failure to Database");

  echo "Connected to database server successfully<br>";

  mysql_select_db($dbname, $conor die ($dbname . 

     "Database not found" . $user);

  echo "Database: " " | ". $dbname ." | "" is selected";

  mysql_close($con);
?>

Download Source Code

Output:

                         

» View all related tutorials
Related Tags: php sql mysql c table data ui insert datatypes types type tutorial field name using ria create tab ie example

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.