I am having trouble pulling information out of my database. I am working on a webpage that logs peoples immigration stories and where they immigrated from. I need to run a query that will allow me to search for a country such as Spain and let me bring up all the entries of people who immigrated from Spain. So far I have this, but I cannot get it to work. Any suggestions would be great! Thanks
<form method = "GET" action="search.php">
</select><input type="submit" value = "Search">
//it then opens 'search.php' which is meant to search through the touchart database
<?php
// open connection to database
$db = mysql_connect("localhost", "root", "");
if (!$db)
{
print "unable to connect!";
exit;
}
// set server access variables
extract($_GET);
//select database to use
$db= mysql_select_db ("touch_art1");
if (!$db)
{
print "could not select database";
exit;
}
$query = "SELECT * FROM temp";
echo $query;
$result = mysql_query($query, $connection);
// print out the results
if( $results )
{ $country_origin = array();
$count = 0;
//check to see if query worked
if (!$result)
{
echo "Query on Connection failed!";
// exit
}
else
{
echo "Query succeeded";
// process results
}
while($row = mysql_fetch_row($result)) {
$country_origin = $row[1];
echo $country_origin.";
}
mysql_close($connection);
?>