Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Wildcards in 3rd party script

LEGEND ,
May 06, 2008 May 06, 2008

Copy link to clipboard

Copied

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
==================


TOPICS
Server side applications

Views

338
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 06, 2008 May 06, 2008

Copy link to clipboard

Copied

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/

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 06, 2008 May 06, 2008

Copy link to clipboard

Copied

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/

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 06, 2008 May 06, 2008

Copy link to clipboard

Copied

.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

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 06, 2008 May 06, 2008

Copy link to clipboard

Copied

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/

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 06, 2008 May 06, 2008

Copy link to clipboard

Copied

LATEST
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/

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines