This is my 1st attempt EVER at PHP and I'm trying to pull a search of countries out of a database I have. I can't get it to work though. Can someone please help me 🙁
<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);
//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);
?>