From: Shoan M. <lis...@sh...> - 2005-09-14 02:14:31
|
Hi, I am getting errors while trying to execute the following sql statement: $sql = "LOCK TABLE gallery_comment WRITE; "; $sql.="SELECT @myLeft := lft FROM gallery_comment WHERE image_id=$imageId;"; $sql.="UPDATE gallery_comment SET rgt=rgt+2 WHERE rgt > @myLeft AND image_id=$imageId;"; $sql.="UPDATE gallery_comment SET lft = lft +2 WHERE lft > @myLeft AND image_id=$imageId;"; $sql.="INSERT INTO gallery_comment (image_id,user_id,subject,comment,posted_on,lft,rgt) VALUES ($imageId, $userId,'$subject','$comment',now(),@myLeft+1,@myLeft+2);"; $sql.="UNLOCK TABLES;"; $flag = $this->db->Execute($sql); I get the following error: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ';UPDATE gallery_comment SET rgt=rgt+2 WHERE rgt > @myLeft AND image_id=1;UPDATE ' at line 1 ADODB_mysql._Execute(SELECT @myLeft := lft FROM gallery_comment WHERE image_id=1;UPDATE gallery_comment SET rgt=rgt+2 WHERE rgt > @myLeft AND image_i..., false) % line 848, file: adodb.inc.php ADODB_mysql.Execute(SELECT @myLeft := lft FROM gallery_comment WHERE image_id=1;UPDATE gallery_comment SET rgt=rgt+2 WHERE rgt > @myLeft AND image_i...) % line 43, file: gallery_commentDao.class.php CommentDao.addNewComment(My new Subject, My new Subject, 4, 1) % line 22, file: addComment.php This sql statement executes fine under phpmyadmin. How do I got about locking tables in adodb? Peace, Shoan. |