function of mysql_select_db in php

It is for static page, dynamic page, website, SEO, performance and other web development discussion
Joshi jahanvi

function of mysql_select_db in php

Postby Joshi jahanvi » Tue Sep 16, 2014 6:01 pm

Explain functions of mysql_select_db with syntax, purpose & example.


Guest

Re: function of mysql_select_db in php

Postby Guest » Sun Sep 28, 2014 4:59 pm

Description

The mysql_select_db() function sets the current active database on the server which is associated with the specified connection.

Syntax

Code: Select all

mysql_select_db(database_name, connection)


Example :

Code: Select all

<?php 
$con = mysql_connect('localhost', 'root', 'mypass'); 
$selected_db = mysql_select_db('na_tutorials'); 
if (!$db_selected) { 
    die ('Database not selected : ' . mysql_error()); 

?>


Return to “PHP, HTML, MYSQL and Web Hosting”

Who is online

Users browsing this forum: No registered users and 2 guests