Skip to main content

PHP Code to Connect Mysql Database

Php mysql connectivity code.............


Write below code in connect.php file


<?Php
ob_start();
$host="localhost:3307"; // Host name
$username="root"; // Mysql username
$password="sa"; // Mysql password
$db_name="dbname"; // Database name
$tbl_name="login"; // Table name
?>

include your connect file in page


include ("config.php");
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

execute your query

$quer2=mysql_query("SELECT * FROM village");
$noticia2 = mysql_fetch_array($quer2);

and that's it .....
www.indbricks.com


Comments

Popular posts from this blog

Upload Photo to server using Android and .Net

In this example with image we are passing some string also like name and description as well as we have Radio button also which is use too map different upload location . Step by step:- 1>                                                  First will be design which is our XML file name photo_upload.xml <? xml version = "1.0" encoding = "utf-8" ?> < ScrollView xmlns:android = "http://schemas.android.com/apk/res/android"     android:layout_width = "fill_parent"     android:layout_height = "fill_parent"      android:orientation = "vertical"     android:fillViewport = "true" >     < RelativeLayout      ...

Where is Java being Used?

The programming language Java was developed by Sun Microsystems in the year 1995. Earlier, it was only used to design and program small computing devices but later adopted as one of the platform independent programming language. The most important feature of Java is its byte code that can be interpreted on any platform including windows, Linux etc. One can also download it freely from the official website of Sun. As we have mentioned above that java-programming language was only developed for the small devices but now it can be found in a variety of devices like cell phones, e-commerce application, PCs and almost all network or computing devices. Java is available in different form: JSP – Like PHP and ASP, Java Server Pages based on a code with normal HTML tags, which helps in creating dynamic web pages. Java Applets – This is another type of Java program that used within a web page to add many new features to a web browser. These are small program used in the progr...