Skip to main content
Inspiring
May 6, 2008
Question

Wildcards in 3rd party script

  • May 6, 2008
  • 5 replies
  • 354 views
I am trying to adapt a 3rd party calendar script for operation on my PHP
site. I'm guessing that the script was writted for use with Access or
something besides MySQL since it uses "*" as a wildcard in the SQL (which I
can fix). But it also uses that wildcard in the body, e.g.,

if (($val['day'] == $cellValue) && (($val['month'] == $this->month) ||
($val['month'] == '*')) && (($val['year'] == $this->year) || ($val['year']
== '*'))) {

How do I patch that - or do I even need to?


--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
==================


This topic has been closed for replies.

5 replies

Inspiring
May 6, 2008
Oh - I see. I thought it was a rather strange usage myself! Hmmm....

OK - I'm going to have to look harder to see why I'm getting an error here -

http://development.bayleys.com/test-calendar.php

The referenced line is contained in this block -

<?php
class CreateQCalendarArray {

var $daysInMonth;
var $weeksInMonth;
var $firstDay;
var $week;
var $month;
var $year;
var $counter;

function CreateQCalendarArray($month, $year) {
$this->month = $month;
$this->year = $year;
$this->week = array();
$this->daysInMonth = date("t",mktime(0,0,0,$month,1,$year));
// get first day of the month
$this->firstDay = date("w", mktime(0,0,0,$month,1,$year));
$tempDays = $this->firstDay + $this->daysInMonth;
$this->weeksInMonth = ceil($tempDays/7);
$this->fillArray();
}

function fillArray() {
// create a 2-d array
for($j=0;$j<$this->weeksInMonth;$j++) {
for($i=0;$i<7;$i++) {
$counter++;
$this->week[$j][$i] = $counter;
// offset the days
$this->week[$j][$i] -= $this->firstDay;
if (($this->week[$j][$i] < 1) || ($this->week[$j][$i] >
$this->daysInMonth)) {
$this->week[$j][$i] = "";
}
}
}
}
}


--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
==================


"David Powers" <david@example.com> wrote in message
news:fvq36p$p4b$1@forums.macromedia.com...
> Murray *ACE* wrote:
>> So, the "*" syntax is correct in PHP?
>
> No. I'm just commenting that the conditional statment is rather
> meaningless. If * means anything, the condition boils down to this in
> plain language:
>
> If the day is the same as the submitted value AND the month is either this
> month or any other month AND the year is this year or any other year.
>
> If any month and any year are acceptable, all that's being checked is
> whether the day is the same as $cellValue.
>
> --
> David Powers, Adobe Community Expert
> Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
> Author, "PHP Solutions" (friends of ED)
> http://foundationphp.com/

Inspiring
May 6, 2008
Murray *ACE* wrote:
> So, the "*" syntax is correct in PHP?

No. I'm just commenting that the conditional statment is rather
meaningless. If * means anything, the condition boils down to this in
plain language:

If the day is the same as the submitted value AND the month is either
this month or any other month AND the year is this year or any other year.

If any month and any year are acceptable, all that's being checked is
whether the day is the same as $cellValue.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Inspiring
May 6, 2008
.oO(Murray *ACE*)

>So, the "*" syntax is correct in PHP?

It's nothing special, just a one-char string. They could also have used
'monkeybutt' as their wildcard, as long as the same value is used in the
DB and in the script.

Micha
Inspiring
May 6, 2008
So, the "*" syntax is correct in PHP?

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
==================


"David Powers" <david@example.com> wrote in message
news:fvpnf5$cj0$1@forums.macromedia.com...
> Murray *ACE* wrote:
>> if (($val['day'] == $cellValue) && (($val['month'] == $this->month)
>> || ($val['month'] == '*')) && (($val['year'] == $this->year) ||
>> ($val['year'] == '*'))) {
>>
>> How do I patch that - or do I even need to?
>
> If * means "anything", that boils down to this:
>
> if ($val['day'] == $cellValue)
>
> --
> David Powers, Adobe Community Expert
> Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
> Author, "PHP Solutions" (friends of ED)
> http://foundationphp.com/

Inspiring
May 6, 2008
Murray *ACE* wrote:
> if (($val['day'] == $cellValue) && (($val['month'] == $this->month)
> || ($val['month'] == '*')) && (($val['year'] == $this->year) ||
> ($val['year'] == '*'))) {
>
> How do I patch that - or do I even need to?

If * means "anything", that boils down to this:

if ($val['day'] == $cellValue)

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/