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!";                 }             }         } 

enter image description here

you cannot compare array string try this:

if ($audiofile['filename'] === $filename) 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -