MySQL PHP Database and String Comparison -
in php comparing file name file on database keeps coming false , unsure why. here code. idea why may happening or how can redo code?
edit: in picture have filename @ top array of files outputting db , can see both filename , array index match up. conversion error of sort?
$cols = array ("filename"); $audiofiles= $db->get ("audiofiles", null, $cols); $dbfile = ""; echo $filename; if ($db->count > 0) { foreach ($audiofiles $audiofile) { echo "<pre>"; var_dump ($audiofile); echo "</pre>"; if ($audiofile == $filename) { echo "yes"; } else { echo "nope!"; } } }
you cannot compare array string try this:
if ($audiofile['filename'] === $filename)
Comments
Post a Comment