Column: 'name' in field list is ambiguous
The DB is set up like DB-'vacation', tables 'jamaica', 'bolivia', and 'haiti', with 'name' and 'id' inside. I need to see if the name of the "searchterms" variable is in the DB.. I thought this might work, but no go.
Code: Select all
<?php
//connect to the DB:
$db = mysql_connect('localhost', 'root') or die('Error. '.mysql_error());
mysql_select_db('vacation', $db) or die(mysql_error());
//set up short variable from posted texfield:
$searchterms = $_POST['searchterms'];
//query setup:
$sql = 'SELECT name FROM haiti, jamaica, bolivia';
$sendSql = mysql_query($sql) or die(mysql_error());
$resultarray = mysql_fetch_array($sendSql, MYSQL_ASSOC);
$matches = mysql_num_rows($sendSql);
echo $matches;
?>