Share on Google+Share on Google+

Php Sql Select

Advertisement
This example illustrates how to execute mysql select query in the php application.

Php Sql Select

 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 mysql_select_db method, how it work and how it is used in php application.

 

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:

Advertisements

Posted on: December 10, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.