Heh. I used this app in one of my sites, (www.9250x.com) it has some
nice features, but whoever programmed it didn't intend for anyone else
to make changes, that's for sure.
The '%%' in the first snippet is some SQL code, '%' is a wildcard in
SQL, so the gist of that section is "If $global_locationID is false,
then make it = 0, and allow the database to return values with ANY
locationID, otherwise just return those records that match the
global_locationID"
The second snippet just builds an array out of the unapproved records.
Like you said.
You're right on with the third as well. I would suggest finding the
place where the query is actually submitted, and add an echo $sql; type
statement so you can see the actual query that is being sent to the
database, that may clear things up a little.
-Micah
On Tue, 2003-01-07 at 09:20, NIPP, SCOTT V (SBCSI) wrote:
> My head is sore from banging my head on my desk, so I will now ask
> the gurus...
>
> I am trying to get a canned Calendar application working, and I am
> running into problems. The application is phpCommunityCalendar by
> AppIdeas.com. The calendar is currently semi-functional, but for some
> reason the approval system is not working for me. I am trying to
> troubleshoot why this is the case and this is where I am running into
> problems. The following is a bit of code that I do not understand and was
> hoping that someone could clear up for me.
>
> ** < Not sure exactly what this code does, especially the %% portion>**
>
> if (!$glbl_LocationID) {
> $glbl_LocationID = "0";
> $LocQuery = "LocationID LIKE '%%'";
> } else {
> $LocQuery = "LocationID = '$glbl_LocationID'";
> }
>
> ** SNIP submitted but NOT approved, this is the Active = '0'>**
>
> $result = mysql("$DBName","SELECT CalendarDetailsID FROM phpCalendar_Daily
> WHERE Active = '0'") or die(mysql_error());
> while ($row = mysql_fetch_row($result)) {
> $ID[$i] = $row[0];
> $i++;
> }
>
> ** SNIP item descriptions for display>**
>
> for ($j = 0; $ID[$j]; $j++) {
> $query .= " OR CalendarDetailsID = '$ID[$j]'";
> }
> $query = ereg_replace("^ OR ","",$query);
> if (!$query) {
> echo "There are no results to display";
> commonFooter();
> exit;
>
> ** SNIP display (Active = 0), nothing actually appears>**
> $result = mysql("$DBName","SELECT *
> FROM phpCalendar_Details
> WHERE ".$LocQuery." AND (".$query.")
> ORDER BY Title") or die(mysql_error());
>
> OK. I have tested the basics of the SQL in both the second section
> and the last section. If I manually query the database as in the second
> section, and then use that output in the query of the last section I am
> returned a record as expected. This is the reason why I am lost as to why
> this is not working here.
> Thanks in advance for the help.
>
> Scott Nipp
> Phone: (214) 858-1289
> E-mail: [EMAIL PROTECTED]
> Web: http:\\ldsa.sbcld.sbc.com
--
Raincross Technologies
Development and Consulting Services
http://www.raincross-tech.com