I have a strange bug where I call an insert query, it executes successfully (the row appears in the DB) but mysql_query returns false. It only returns false when a particular field contains an underscore or dash (or probably some other chars but these are the two I’ve run into so far).
"INSERT INTO Hoopoes (name, owner, dbuser, dbpass, package) VALUES "
."('".$this->config['hname']."', '".$this->config['email']."','".$db_prefix.$db_username."','$db_userpass',"
."'".$this->config['package']."')"
So this is the query. It fails when config['hname'] contains _ or -. I don’t understand why. The row appears in the DB, but mysql_query still returns false. Any insight would be much appreciated
You mus select the database after connect and before any query:
You can use your INSERT query without select a database when you specify the schema, like this: