I've written this simple function that is taking array values and searching two tables to see if they exist. The first one is having the issue, "SHOW TABLES LIKE" None of the values exist in the database except apple, yet they are all coming back true. The second query "SELECT * FROM stocknames is working correctly.
$symbols = array('apple','joe','steve','adsffds');
function checkStockNames($symbols) {
if(is_array($symbols)) {
echo "<p>This is an array</p>";
foreach($symbols as $symbol) {
if(mysql_query("SHOW TABLES LIKE '".$symbol."'")) {
$query = mysql_query("SELECT * FROM stocknames WHERE symbol = '{$symbol}'");
if($data = mysql_fetch_assoc($query)) {
echo "<p>{$symbol} is {$data['name']}</p>";
} else {
echo "<p>{$symbol} does not have name information.</p>";
}
} else {
echo "<p>{$symbol} does not have a table in the database.</p>";
}
}
} else {
echo "<p>This is not an array</p>";
}
}
checkStockNames($symbols);