MySQL table exists on the server but cannot be accessed from PHP
I added a new table to the database using PHPMyAdmin; when trying to access it from a PHP page, I get the dreaded MySQL "table does not exist" error.
The database connection data is fine, it uses multiple rows above on one page to access another table in the same database. If I do SHOW TABLES
in PHPMyAdmin, then a new table is displayed; if I do it from a PHP page, the new table doesn't appear in the list. The mechanism for the new table is MyISAM, like all other tables in the database. I can only access the db server through PHPMyAdmin.
Sorry, I forgot the code, here it is:
$db = mysql_connect ($db_host, $db_user, $db_password) or
die("Error message here");
$db_select = mysql_select_db($db_name, $db)or die("Error message here");
$query = ("SELECT * FROM `old_table`");
$result = mysql_query($query);
while ($row = mysql_fetch_array($result))
{
// do stuff - here it works
}
$query = ("SELECT * FROM `new_table`");
$result = mysql_query($query);
while ($row = mysql_fetch_array($result))
{
// do stuff - here it does not work
echo mysql_error();
}
source to share
On Unix, table names are case sensitive. This is not the case on Windows. Fun, isn't it? Actually, like their respective file systems. Do you think this is a coincidence?
It probably depends on the type of table; MyISAM in your case.
Field names are not case sensitive.
For database and table names, this depends on the underlying operating system. Identifier ID sensitivity
source to share