'How to search in a column with more row a specific word?
Maybe my question was already answered before, but my mistake if I don't know the correct specific words to search for it. So, I have this code
<?php
$adm = connect::$g_con->prepare("SELECT * FROM `admins` WHERE `access` LIKE '%t%' or `access` LIKE '%n%' ORDER by Admin DESC");
$adm->execute();
while($row = $adm->fetch(PDO::FETCH_OBJ)) { ?>
<?php
if($row->access == '%t%') echo ' <span class="badge" style="background-color:#CC9900"><strong>VIP GOLD</strong></span>';
if($row->access == '%n%') echo ' <span class="badge" style="background-color:#6F7683"><strong>VIP SILVER</strong></span>';
?>
<?php } ?>
My problem is that in those 2 IFS. I have a column admin with more rows (around 20). My issue is that on first if i want to search in all of those 20 rows from admins column and if letter T is found to echo VIP GOLD
Same with the second if, but letter N. Anyway if I will figure it out with T, of course will be the same for the second.
Sorry again, if I don't explain it correctly, these are my first days into php. Not trying to learn big, but at least what I need.
If it helps, here is the code I want to make it work https://ploiesti.csstats.eu/vips On the grade column, to show GOLD or SILVER depending if those persons has T or N in the flags behind their names.
Many thank for the help. Regards.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
