<?
// Connect To MySQL Server
@mysql_connect($server, $username, $password) or die("Couldn't Connect to Database");
// Select Database
@mysql_select_db($database) or die("Couldn't Select Database");
// don't forget to use array() when defining an array
// the way you had it would produce a parse error
$array = array(1, 2, 3);
$query = "SELECT * FROM your_table";
echo $query . "<br>\n";
for ($i=0; $i < count($array); $i++) {
if ($query == 'SELECT * FROM your_table') {
$query .= " WHERE name='$array[$i]'";
} else {
$query .= " OR name='$array[$i]'";
}
}
$result = mysql_query($query) or die(mysql_error());
// do whatever you want with the results
?>
Don't forget to change your_table to your table name in the select statement AND in the if statement.
Cgraz