vendredi 18 décembre 2015

in array inside of if

I need to show a div when the value exist inside of the array, I have this code

<?php if (in_array("odontologia basico", $s)) { ?>
    <li><a href="#1">Consulta odontol&oacute;gica</a></li>
<?php } else { ?>
    <li><a href="#1">Consulta m&eacute;dica</a></li>
<?php } if (in_array("alergologia", $s)) { ?>
    <li><a href="#alergia">Prueba de Alergia</a></li>
<?php } if (in_array("odontologia basico", $s)) { ?>
    <li><a href="#odonto">Odontograma</a></li>
<?php } ?>

in the DB the row have this values:

$s = ("dermatologia", "alergologia", "pediatria");

and in the select statement the row:

$s = explode(', ',$row['s']);

but the div is not showed .. I have three values( more or less values) but right now any is showed...can you help me with this please

when I put print r this is showed in the page:

Array ( [0] => dermatologia [1] => alergologia [2] => pediatria )

Aucun commentaire:

Enregistrer un commentaire