Pretty simple, a lot of people use PHP files too do this,
Here are a few things;PHP Code:<?php
mysql_query( "QUERY" );
?>
SELECT - Select's from your database
* - Wildcard; grabs everything matching your query critera.
WHERE - Where field name has the result of
So here's an example query, using the three of them;
And a bit of PHP..Code:SELECT * FROM `users` WHERE `id` = '1'
That above, is just a simple select statement, and will repeat any result with the field named "id" which has the result of 1.PHP Code:<?php
// Assume we're already connected to the database ;)
// Querying the database..
$query = mysql_query( "SELECT * FROM `users` WHERE `id` = '1'" );
// While - gets all the results and does what you want to do with them in the while statement, and continously repeats them.
while( $object = mysql_fetch_object( $query ) )
{
echo $object->username; // You can use object or arrays, I'm an object fan. We're grabbing the field name "username"
}
?>





Reply With Quote





