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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Angry Coder
Forum Newbie
Posts: 2
Joined: Tue Jun 25, 2002 8:53 am

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

Post 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.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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
Post Reply