| Bug #1478 | Unknown column (...) in 'field list' | ||
|---|---|---|---|
| Submitted: | 4 Oct 2003 10:58 | Modified: | 5 Oct 2003 8:27 |
| Reporter: | Juan Humberto Artero | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | MySQL Server: Command-line Clients | Severity: | S1 (Critical) |
| Version: | OS: | Windows (window NT) | |
| Assigned to: | CPU Architecture: | Any | |
[5 Oct 2003 8:27]
Alexander Keremidarski
Sorry, but the bug system is not the appropriate forum for asking support questions. Your problem is not the result of a bug. For a list of more appropriate places to ask for help using MySQL products, please visit http://www.mysql.com/support/ Thank you for your interest in MySQL. "... I've actually arrived to the conclusion that the problem reside in the way that the query is send from the textarea to the preceding code." Correct. Which as you can see has nothing to so with MySQL code. It is all about debugging of your PHP code.

Description: I've got this little text code to retrive the query from a form textarea. <? include "connection.php"; //constructing an string which is a mysql query $query = trim($sql);//$sql is a string retrieved from a form <textarea name=sql //Sending the query to the database $result = mysql_query($query, $dbh); if ( $err = mysql_error($dbh) ) { echo "Bad query, my friend."."<br/>"; } echo "Query : ".$query."<br/>"; echo "Error : ".$err."<br/>"; ?> The name of the <textarea> html tag is name="sql" (I've actually try name=sql, too). If no error the query is sent to mysql web hosting. It works fine, I'm able to create tables, drop tables, select whatever I want. I can insert integer too; but when I try to insert alphabetical characters(a-z, A-Z) using insert into table A15Bulb(bulbCode) values('60A15/F/Br') I receive an error message saying : Unknown column ('60A15/F/Br')in 'field list'. I've actually modifified the above code in this way: I've written the query directly into the code, as a result of this change it work fine, no trouble at all. <? include "connection.php"; $sql="insert into A15Bulbs(bulbCode) values ('99A15/F/Br')";//******* //constructing an string which is a mysql query $query = trim($sql); //Sending the query to the database $result = mysql_query($query, $dbh); if ( $err = mysql_error($dbh) ) { echo "Bad query, my friend."."<br/>"; } echo "Query : ".$query."<br/>"; echo "Error : ".$err."<br/>"; ?> As consequence of this little experience I've actually arrived to the conclusion that the problem reside in the way that the query is send from the textarea to the preceding code. How to repeat: Every time I try to insert alphabetical characters Suggested fix: I've not idea. I'm so sorry