Re: Unknown column 'Test' in 'field list'
| From: | David Christensen | Date: | Fri, 29 Mar 2002 01:59:27 +0000 |
| Subject: | Re: Unknown column 'Test' in 'field list' | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-18020@lists.php.net to get a copy of this message | ||
Change your query to this and make sure your ID field is set to "auto_increment"
INSERT INTO entry (user_name) values ('$name')
That'll work for sure! ;-)
Jennifer Downey wrote:
Hi All! Hope I'm not bothering you nice people too much. I have a account called Test, when I click the submit button I get this error Unknown column 'Test' in 'field list' My table only has two fields id and user_name I am not trying to insert the data into the field Test but into usre_name. I had this problem once before but I can't remember how I fixed it or if I ever did. Any ideas? <?php if($action == "Submit my entry"){ if (!empty($name)){ $enter = "insert into entry (id, user_name) values (' ',$name)"; mysql_query($enter) or die(mysql_error()); } exit; } $query="SELECT name FROM users WHERE uid=".$session["uid"]; $ret = mysql_query($query) or die(myasql_error()); list($name) = mysql_fetch_array($ret); ?> <CENTER><table ALIGN="center" WIDTH="80%"><tr> <td><form ACTION="<?php echo($PHP_SELF);?>" METHOD=post> <?php print "<td><br>Username: <input type=\"text\" value=\"$name\" name=\"u_name\" size=30></td></tr>\n<tr><td>"; print "<input TYPE=\"submit\" name=\"action\" VALUE=\"Submit my entry\"><BR><BR>"; ?> </form></td></tr> </table></CENTER>