Re: Can't figure out why getting "query was empty" error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux