About Me

My photo
Nadiad, Gujarat, India
Hi Friends I am Vipul Soni, an Innovative web Designer & Developer with Excellent skills who thrives on challenges and is passionate for all areas of web Design & Development.

Monday 31 January 2011

php tricks: connect to database & retrive data from database

Here is th code : use it in the .php file

<?php
mysql_connect("localhost","root","");
mysql_select_db("mydatabase");
$qry=mysql_query("select * from table");

while($rs=mysql_fetch_row($qry)) //loop untill find numbers of records from table
{
echo "$rs[0]"; //Retrive first field data
echo "$rs[1]"; //Retrive second field data
echo "<br />"
}
?>

Vipul Soni

0 comments:

Post a Comment