PHP Classes

update function

Recommend this page to a friend!

      Unlimited sub-categories  >  All threads  >  update function  >  (Un) Subscribe thread alerts  
Subject:update function
Summary:I think I fixed an error here
Messages:2
Author:Adam Docherty
Date:2006-03-23 03:18:03
Update:2006-03-23 03:47:12
 

  1. update function   Reply   Report abuse  
Picture of Adam Docherty Adam Docherty - 2006-03-23 03:18:03
hi I noticed that the update function wasn't moving all the sub categories when you changed the parent. I think this was to do with the query to retrieve the sub categories.

around line 157 the query reads as follows:

$sql2 = "UPDATE ".$this->table_name."
SET position = '".$new_sub_position."'
WHERE position RLIKE '".$sub['id']."%>'";

I found that by changing the WHERE line to:

WHERE id =".$sub['id']."";

the problem was solved.

I am not sure if this problem was confined to my setup, but if you are having the same problems try this method.

@Shadi,

I have worked extensively with this class and I must commend the technique used to create infinite categories - it had me stumped!!! Great thinking and power in simplicity, Shadi :)

-Lobos of www.webvida.com

  2. Re: update function   Reply   Report abuse  
Picture of S.Shaban S.Shaban - 2006-03-23 03:47:12 - In reply to message 1 from Adam Docherty
Hello Lobos,
Thanks for your interest.

I encourage your modification to the query as it will work more efficiently.

I'll update the class now.

Regards,