I have a problem with my php application.This is running on pp 5.2 and mysql 5.6
When I try to run this
<?php
$dbname ='LAA-dbname';
if (!mysql_connect('mysq123.php.server', 'LAAuser', 'mypwd')) {
echo 'Could not connect to mysql';
exit;
}
$sql = "SHOW TABLES FROM $dbname";
$result = mysql_query($sql);
if (!$result) {
echo "DB Error, could not list tables\n";
echo 'MySQL Error: ' . mysql_error();
exit;
}
while ($row = mysql_fetch_row($result)) {
echo "Table: {$row[0]}\n";
}
mysql_free_result($result);
?>
I am getting this error
DB Error, could not list tables MySQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-dbname' at line 1
What can be the reason? Thanks