php - How to find if $row contains certain characters -
having bit of coding issue, how can check see if value of $row['value'] contains characters, in case, if 'rename_file' contains filename has '128' in it. have doesn't seem echo when is.
$row = mysql_fetch_assoc($result); { while ($row = mysql_fetch_assoc($result)) { echo $row['c_id'] . " " . $row['source_file'] . " " . $row['rename_file'] ." " . $row['p_id']; if ($row['rename_file'] = '%128%') { echo "<p> 128"; } else echo "<br>"; } }
many thanks. cp
use preg_match()
:
if(preg_match('/128/',$row['rename_file'])){ echo "<p> 128"; } else { echo "<br>"; }
or strpos()
:
if(strpos($row['rename_file'], '128') !== false){ echo "<p> 128"; } else { echo "<br>"; }
Comments
Post a Comment