How do you get data from database when you pick up item from database list?

  • Home How do you get data from database when you pick up item from database list?
How do you get data from database when you pick up item from database list?

How do you get data from database when you pick up item from database list?

July 9, 2009

Question:
How do you get data from database when you pick up item from database list?

Answer:
Here is a simple method for connecting to your MySql database and outputting some data.

<?php

#Connect to MySQL database
$db=mysql_connect("localhost","YourDatabaseUserName","YourDatabasePassword");
mysql_select_db("YourDatabaseName",$db) or die ("cant change");

#Select data from database table called customers.
$result = mysql_query("select * from customers Order By LastName, FirstName",$db);

while ($row = mysql_fetch_array($result))
{
$FirstName = $row["FirstName"];
$LastName = $row["LastName"];

echo "$LastName, $FirstName"; ?><br><?

}

?>

About the Author
Rich Agnew is an author for The Computer Geek Custom Web Page Design. The Computer Geek is a web design company that prides itself in professional service at a fraction of the cost. The Computer Geek specializes in Custom Web Design, PHP & MySql and Ecommerce.

To Make a Request For Further Information

5K

Happy Clients

12,800+

Cups Of Coffee

5K

Finished Projects

72+

Awards
TESTIMONIALS

What Our Clients
Are Saying About Us

Get a
Free Consultation


LATEST ARTICLES

See Our Latest
Blog Posts

The Role of User Experience in E-Commerce Success
November 20, 2024

The Role of User Experien

Top Strategies for Improving Organic Search Rankings
November 19, 2024

Top Strategies for Improv

The Benefits of Using Video Content for Marketing
November 18, 2024

The Benefits of Using Vid

Intuit Mailchimp