Bitcoin Forum
February 16, 2026, 03:21:00 PM *
News: Community awards 2025
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: PHP question... yes it's crypto related.  (Read 479 times)
MoreBloodWine (OP)
Legendary
*
Offline Offline

Activity: 1064
Merit: 1001


View Profile
June 12, 2015, 09:38:02 AM
 #1

Question...

Code:
              <li <?php if ($page == 'lotteries' || $page == '*_lottery') { echo 'class="active"'; } ?>>
                <a href="index.php?page=lotteries"><?php echo $lotto_button?></a>
              </li>

I know the above will never work but it helps me get my question asked, how can I have it so the * is wildcard for any possible combination ?

ex. hi_lottery, how_lottery, are_lottery, you_lottery

Basically as I add pages that are *_lottery, the class should always be active.

Ty.

This is for the site in my sig.

To be decided...
Mitchell
Moderator
Legendary
*
Offline Offline

Activity: 4564
Merit: 2650


Verified awesomeness ✔


View Profile WWW
June 12, 2015, 09:40:35 AM
 #2

This took me 1 second to Google: http://stackoverflow.com/questions/9369060/wildcard-in-an-if-statement

Looking for a signature campaign, DM me.
altcoinhosting
Hero Member
*****
Offline Offline

Activity: 896
Merit: 1006


View Profile
June 12, 2015, 09:41:05 AM
 #3

http://php.net/manual/en/function.preg-match.php

Gultahin
Member
**
Offline Offline

Activity: 84
Merit: 10

۩۞۩ secondstrade.com ★


View Profile
June 12, 2015, 09:52:45 AM
 #4

You have to pass parameters to bind_param() by reference, which means you have to pass a single variable (not a concatenated string). There's no reason you can't construct such a variable specifically to pass in, though:

Code:
$className = '%' . $this->className . '%';
$query->bind_param('s', $className);

▲▼▲▼▲▼▲▼  No.1 Bitcoin Binary Options and Double Dice  ▲▼▲▼▲▼▲▼
████████████████████████████████  sec◔nds trade  ████████████████████████████████
↑↓ Instant Bets ↑↓ Flexible 1~720 minutes Expiry time ↑↓ Highest Reward 190% ↑↓ 16 Assets [btc, forex, gold, 1% edge double dice] ↑↓
MoreBloodWine (OP)
Legendary
*
Offline Offline

Activity: 1064
Merit: 1001


View Profile
June 13, 2015, 03:26:02 AM
 #5

Code:
              <li <?php if ($page == 'lotteries' || preg_match("/(.*)_lottery/"$page)) { echo 'class="active"'; } ?>>
                <a href="index.php?page=lotteries"><?php echo $lotto_button?></a>
              </li>

Problem solved.

To be decided...
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!