Forum Moderators: coopster

Message Too Old, No Replies

PHP MySQl insert object error

PHP MySQL Insert object error unknown column in field list

         

MrWhippy

2:25 pm on Mar 4, 2009 (gmt 0)

10+ Year Member



Hi all,

I am getting an error currently when I try to add an object into my db.

the error is Unknown column 'Steve' in 'field list'

The insert statement is as follows.


DbConnect();//function stored in library.php to connect to the database
$query = ("INSERT INTO users (active, username, pwd, email, first_name, surname, tel, club_id)
VALUES('$active', '$this->UserName', '$this->UserPwd', '$this->UserEmail', $this->UserFirst, $this->UserLast, $this->UserTel, '$club' )") ;
mysql_query($query)
or die(mysql_error());

I have used the same code before but not for an object can anyone shed any light on this for me.

sorry should have said steve is stored in $this->UserName

[edited by: MrWhippy at 2:26 pm (utc) on Mar. 4, 2009]

MrWhippy

2:36 pm on Mar 4, 2009 (gmt 0)

10+ Year Member



Fixed for some reason I hadnt quoted the last three object vars.