This topic is locked
[SOLVED]

Question about like and wildcard operators in the events pages

12/30/2021 4:18:50 AM
PHPRunner General questions
D
Dynamiccomp author

I have a bunch of IF, Else statements which I have been trying to use to achive my desired outcome, and I have tried the following variations, but none seem to work correctly:

if ($values['Division'] = "Training%" ...
if ($values['Division'] = 'Training%' ...
if ($values['Division'] = "Training*" ...
if ($values['Division'] = 'Training%' ...
if ($values['Division'] == "Training%" ...
if ($values['Division'] == 'Training%' ...
if ($values['Division'] == "Training*" ...
if ($values['Division'] == 'Training*' ...

I also tried using the Like operator, but quickly found that I couldn't use "like" or at least thats what the error was stating.

In some cases there might be multiple variations of the Divisions, and is defined by the user, so sometimes there would be (Training, Training A, Training B, Training - A, Training - B ...) so i want the code to be able to execute no matter what comes after Training, or even if just Training exists, and from what i have been experiementing with, nothing is working, can someone please tell me what i am doing incorrectly please?

K
kohle 12/30/2021

Try this :

if (substr($values['Division'],0,8) == 'Training')
{
...
}

rg
J.

D
Dynamiccomp author 12/30/2021

Thank you that seemed to do the trick.