Re: Can't figure out why getting "query was empty" error
| From: | Chris | Date: | Thu, 04 Jan 2007 02:07:50 +0000 |
| Subject: | Re: Can't figure out why getting "query was empty" error | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-42876@lists.php.net to get a copy of this message | ||
pantichd wrote:
Figured it out. The name of the table was "Person" instead of "person"...First letter was a capital "P" I didn't realize that the sql was case-sensitive.It is with table names, field names and table aliases. Stuff like "SELECT", "INSERT", "UPDATE", "WHERE" isn't case sensitive (the sql keywords). Also - if you want help, please post the problem code *exactly*. You had three problems in the post that have nothing to do with this solution: mysql_select_db ("<table>"); (Not really a problem but I highly doubt your database is called "<table>") mysql_query("INSERT INTO person (FirstName, LastName, Age) VALUES('Jack', 'Bauer', '67')"); //Try to insert the record if (!mysql_query($sql,$con)) $sql is not defined anywhere - this would produce a "query is empty" error. and finally you were running the query twice. It's not a "problem" but it would be a hard-to-find-bug: // Close the connection mysql_query($sql,$con);mysql_close($con); If you post the exact code that's having the problem it makes it so much easier for everyone to help... -- Postgresql & php tutorials http://www.designmagick.com/