using WHERE with a list?
Posted 11 February 2006 - 09:45 PM
// Make a MySQL Connection
mysql_connect("localhost", "admin", "1admin") or die(mysql_error());
mysql_select_db("test") or die(mysql_error());
// Get a specific result from the "example" table
$result = mysql_query("SELECT * FROM example
WHERE name='Sandy Smith'") or die(mysql_error());
// get the first (and hopefully only) entry from the result
$row = mysql_fetch_array( $result ); // Print out the contents of each row into a table
echo $row['name']." - ".$row['age'];
In particular, I want to specify a list of records to obtain from the database, rather than just one. The contents of the list needs to be explicitly specified, as does the order, since it is based on something that simply can't be programmed to order them automatically.
Using the above example, instead of just displaying the record for Sandy Smith, I would like to display the records for Bobby Wallace, Tim Mellowman, and Sandy Smith, in that order. How would I rewrite the above in order to produce this?
Posted 11 February 2006 - 10:03 PM
Posted 11 February 2006 - 10:48 PM
Posted 12 February 2006 - 07:25 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users