I'm trying for two days to create an array with the result of a mysql query as values to prevent a appears:
foreach($achievements as $acvhm2){
if(!array_key_exists(($acvhm2['key'] - 19999 ), $achievements)){
if($acvhm2['key'] - 20000 == $tam){
$san .= $tam.',';
$san1 = substr($san, 0, -1);
}
}
}
$orgly2 = array($san1);
if(!in_array($tam, $orgly2)){
echo ' <tr><td style="opacity:.64;">... ';
}
but it doesn't work for all the < tr > that I got on results...
when I do the array manually everything works perfectly:
$orgly2 = array(3,5,13);
all results where $tam is equal to one of the numbers in the array are left with opacity 64.
anyone have any idea what is wrong in my code?
I think you're looking for explode()
:
$orgly2 = explode(',',$san1);
You were basically creating an array with one argument that is a string with commas that would look something like this:
$orgly2 = array('3,5,13');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.