Wazoo Posted October 26, 2005 Share Posted October 26, 2005 The D2-FAQ thing I'm using has a number of 'interesting' issues ... for instance, a call is made to delete articles in one bit of code, but as it turns out the released package includes a module in which that function doesn't exist. Much bitching (for quite a while) on Dean's board with little response. Over on Invision, someone offered up a bit of a patch to insert the missing delete function (and a couple of other things) ... in the next 100 or so posts there are a (small) number of folks offering praise and thanks, another number of them still having issues, one post with a "bug fix" on the "enancement" ... No bif deal, as the wy the conversion process is going on the FAQ, deleting things was not an issue ... that is until today .. went to inser an item which turned out to be a fellow Moderator's post in which he grabbed a bit of one of my previous posts somewhere else and posted that in one of the How To forum sections. It ws only after I'd snagged that post data, inserted it into the new thing, refreshed a browser window, saw it was there, followed the link to check the display ... saw that there was a missing [ /color ] tag ... no proble, "backed" up the editing browser window a couple of screens, inserted the missing bir, resubmitted the article, hot the other window, did a Refresh, code was still bad ....rinse and repeat a few times, getting totally wierded out, last edit was done all in lower-case but the displayed page was in all caps ... hmmm, closed a few windows to get a fresh start ... turns out I had inserted the same article six times, but of course all my "checking" was being done looking at the first one ... OK, I already know that there is no Delete function, so I'll just go in and edit one of the bad/extra ones and make that a totally different FAQ entry, move it to anther Category ... hmmm, forgot about Bug #2, the category counts of contained Articles doesn't update when you move Articles around ... OK, let's go se if he's updated things yet ... 49 pages of Forum entries on his support forum, I'm reading the same entries I read before ... then stumble on one that mentions a 'fix' over on Invsionize ... so over to there I go ... ( pages of postings, find "the patch" on page 7 (bug fix to patch on the same page, 4 posts after all that with "it works fine" in amongst all the other complaining of install issues ...) So, thinking I was ahead of the game, I inserted 90% of the code in the first patch post, and used the "vug fix for patch" in the later post to take care of that last bit ... jumped in, hit the Delete button, got the "are you sure" thing popping up, hit yes, and the "Article is gone .. Great! .. Delete the rest of the extras ... feeling good! Of course, then I back up a bit and now see that the Categoies are shopwing wierd numbers .. like the ones I hadn't put anything into yet were showing negative numbers .. and of course the ones with content were definitely wrong ... I gad to manually go in, count what each Category had and do a manul SQL query to get the numbers back in order ... OK, so lets go with the second 'fix' was bad (more on that in a bit) so I commented that line out and reinserted the line from the first "fix" .. made a scratch post into one Topic, checked, it was added, things look good .. went in and deleted it .. everything worked, Article was gone ... ok, fixed .. whoops, the Category that was once 0, then showed (1) Comment, had that item Delted .. was now showing (-1) ... I know, not enough code to do a full analysis, but I'm just struggling with what the real difference is here ... This the (original) lone that turns out to subtract 2, though showing a "-1" in the code $DB->do_update('faq_cats', array('c_tarts' => $cats['c_tarts'] - 1), 'c_id='.$a['a_cat']); [cat$ is a reusable variable, used to hold an array, built for (seems like hundreds) each 'module' in this scri_pt .. c_tart$ is the "number of articles" c_id is the "article number" in the database ...a+cat is the category the article is "under" ] This was "the fix" that ended up subtracting "1" from each and every Category (will also note that at first run, it didn't fly because the Table entry was hard-coded and missing the database prefix used 'here' ... added in the prefix (the xxx_) and the results had me believing that it was working) $DB->query('UPDATE xxx_faq_cats SET c_tarts=c_tarts-1', 'c_id='. $a['a_cat']); I'm lost as to why these two lines have such different results .. neither of them seem to wrk correctly ... but even more baffled by the "it works fine" comments from others that allegedly inserted the same code (though no one else mentioned the hard-coding issue???) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.