Page 1 of 1

Impossible! Where is the error?! (UPDATE categories SET...)

Posted: Mon Jul 22, 2002 6:13 pm
by Angry Coder
Hi,

I have a class to manipulate MySQL functions, one of these functions is:

Code: Select all

function query ($query)
  $this->result = @mysql_query ($query, $this->link)
  or die ("Error: mysql_query.");
return $this->result;
}
My question is why the fallowing is not working?!

Code: Select all

$DB->query ("UPDATE categories SET
pid = '$pid',
ctitle = '" . addslashes ($ctitle) . "',
cdescription = '" . addslashes ($cdescription) . "',
cphoto = '" . addslashes ($cphoto) . "'
WHERE cid = '$cid'");
Where is the error :evil:

Code: Select all

$DB->query ("INSERT INTO categories (cid, pid, ctitle, cdescription, cphoto) VALUES
(NULL, $pid, '" . addslashes ($ctitle) . "', '" . addslashes ($cdescription) . "', '" . addslashes ($cphoto) . "')");
The code above (INSERT...) works!

That's why i am angry :wink:

Thank you.

Posted: Mon Jul 22, 2002 7:26 pm
by volka
replace

Code: Select all

or die ("Error: mysql_query.");
by

Code: Select all

or die ("Error: ".mysql_error());
and let mysql explain it :D