I designed a simple web interface to a database on localhost. On the localhost, if I attempted to send an SQL command to create a record, and used an invalid FK in one of the fields, then the PHP mysql_query
returns false and I have my PHP script return the mysql_error()
which of course has some info about the FK I tried to violate.
I moved the entire project to a HostGator account I have, and created the DB tables using the EXACT same SQL setup script. When I try to violate a FK here though, the mysql_query
returns true, so my PHP script acts as if the request succeeded, which of course it didn't.
In both cases, nothing gets inserted into the DB, but for some reason in the latter case mysql_query
is returning true. Also in the latter case mysql_error()
appears empty, even though clearly I've made an error.
Is there a server setting somewhere that controls this?
Thanks!
EDIT:
Similar issue, on the remote server I am able to delete a record which has FK dependencies. It seems the hostgator version is not enforcing referential integrity at all. :-(