web hosting line
1.866.605.2484
Free Web Hosting

PHP/MySQL Tutorial - PHP MySQL Connection

Step 5:

How to Select Individual Records

As well as showing the whole database, PHP can be used to select individual records, or records which match certain criteria. To do this you must use a variation of the SELECT query. To display the whole table you used the query:

SELECT * FROM tablename

If we just wanted to select ones which have value=1 in the field1-name row you would use the following query:

SELECT * FROM tablename WHERE fiels1-name='1'

As with other MySQL queries, it is almost like plain English text. In the same way you could select records based on any field in the database. You can also select ones with more than one field by adding more:

field='value'

sections onto the query.

For further reference you can visit the official websites of PHP and MySQL.



PHP Hosting
(c) Copyright 2006 SiteGround Web Hosting Provider. All rights reserved
Previous Next
Resources: Tutorials . Video Tutorials . Web hosting FAQ . Joomla templates . WordPress themes . Web hosting forum
Quick links: eCommerce hosting . Joomla hosting . Magento hosting . phpBB hosting . WordPress hosting . Blog Hosting . cPanel hosting . FTP hosting . Flash hosting . Website Design
Copyright © 2009 SiteGround.com Inc