php - Output of a query displaying as null -


I am trying to trigger a list of files where an area ARTICLE_NO is a fixed number Right now, I have There is a file table, with column ARTICLE_NO, FILENAME and USERNAME. There is a record, respectively, with 1, x.txt and user respectively. $ Pk is assigned to 1 in my php code. However, the following code only produces the tap, and why am I unsure.

  $ filesQuery = "select files FILENAME where ARTICLE_NO =?"; If ($ getFiles = $ con- & gt; create ($ filesQuery)) {$ getFiles-> gt; Bind_param ("s", $ pk); $ GetFiles-> Executed (); $ GetFiles-> Bind_result ($ FILENAME); $ Files = array (); While ($ getFiles-> fetch ()) {$ filenames = array ('FILENAME' =>; $ FILENAME,); $ Files [] = $ filename; }} Var_dump ($ files ['FILENAME']); Forex Currency ($ files as $ files) {$ filesList = '& lt; P & gt; & Lt; A href = "./files/ '. $ Files [' FILENAME ']." "& Gt; '$ files [' FILENAME '].' & Lt; / a & gt; ' . "\ N";}  

You are reaching the array you created $ Files while working with the 1 result row from the database contains an array that contains 1 other array that looks like this:

  $ files = array (0 = & gt; array ('FILENAME' = & gt; 'X.txt'));  

Therefore, to access the value under FILENAME, you need to use:

  var_dump ($ files [0] ['FILENAME']);  

or

  foreach ($ files_data) $ Files) {echo $ File_data ['FILENAME'];}  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -