RE: [PHP-DB] Unknown column 'Test' in 'field list'

2002-03-29 Thread Jonathan Hilgeman

Even though this is solved, I should mention a method that I find to be
personally easier to use when INSERTing records. Simply use the field=value
method:

INSERT INTO MyTable SET firstname='Joe', lastname='Bob', age=58;

By doing it this way, you don't have to worry about matching up the number
of columns to values, or the order of the fields (the above example could
have age or lastname as the first value without changing the output). Not to
mention this method is a little easier to read and easier to construct.

- Jonathan

-Original Message-
From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 6:55 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Unknown column 'Test' in 'field list'


Never mind I forgot to put  '  ' around $u_name in my insert.

Jen



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

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




Re: [PHP-DB] Unknown column 'Test' in 'field list'

2002-03-28 Thread David Christensen

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);
 ?
 
 CENTERtable ALIGN=center WIDTH=80%tr
 tdform ACTION=?php  echo($PHP_SELF);? METHOD=post
 
 ?php
 print tdbrUsername: input type=\text\ value=\$name\
 name=\u_name\ size=30/td/tr\ntrtd;
 print input TYPE=\submit\ name=\action\ VALUE=\Submit my
 entry\BRBR;
 ?
 /form/td/tr
 /table/CENTER
 
 
 
 
 
 



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