Page 1 of 1

Whats wrong ??

Posted: Wed May 19, 2004 10:37 am
by winsonlee
Failed to execute query: Unknown column 'Helllo' in 'field list'

That is the error msg that i get in my following code. I would like to know what goes wrong with it.

Code: Select all

$title = $_POSTї'title'];
$message = $_POSTї'yourFieldNameHere'];
$datex = time();

$result = database("INSERT INTO `xoops_weblog` ( `blog_id` , `user_id` , `cat_id` , `created` , `title` , `contents` , `private` , `comments` , `reads` , `description` , `dohtml` ) VALUES ('', '1', '2', $datex, $title, 'hello', 'N', '0', '0', '', '0')");

Posted: Wed May 19, 2004 10:47 am
by leenoble_uk

Code: Select all

$title = $_POSTї'title']; 
$message = $_POSTї'yourFieldNameHere']; 
$datex = time(); 

$result = database("INSERT INTO xoops_weblog ( blog_id , user_id , cat_id , created , title , contents , private , comments , reads , description , dohtml ) VALUES ('', '1', '2', '$datex', '$title', 'hello', 'N', '0', '0', '', '0')");
I assume database() is a function which processes the query.

Posted: Wed May 19, 2004 10:48 am
by dave420
Have you tried putting your $variables ($datex and $title) in backticks?

Posted: Wed May 19, 2004 10:53 am
by leenoble_uk
Also MySQL can create the timestamp itself instead of using the PHP variable.

Code: Select all

"INSERT INTO xoops_weblog ( blog_id , user_id , cat_id , created , title , contents , private , comments , reads , description , dohtml ) VALUES ('', '1', '2', UNIX_TIMESTAMP(NOW()), '$title', 'hello', 'N', '0', '0', '', '0')"