Query Execution

Permalink
I am unable to execute the query due to the template value (<%=file.fID%>)
i am getting a number but while printing it shows an empty array
<script type="text/template" data-template="search-results-table-body">
<% _.each(items, function (file) {%>
<tr data-launch-search-menu="<%=file.fID%>" data-file-manager-file="<%=file.fID%>">

</script>
<%=file.fID%> comes from the above code
$db= Loader::db();
$query="SELECT * FROM `FileStatus` WHERE `fID`="."'<%=file.fID%>'";
$rs = $db->GetAll($query);
print_r($rs);

 
jasteele12 replied on at Permalink Reply
jasteele12
I have no idea where <% is coming from, but I can tell you that your PHP query string should look like.

Instead of:
$query="SELECT * FROM `FileStatus` WHERE `fID`="."'<%=file.fID%>'";

use something like this (assuming $fID has been sanitized)::
$query="SELECT * FROM FileStatus WHERE fID = " . $fID;

<?php echo $fID; ?> will most likely return true, meaning the echo was successful, but not what you want in a query.
mohamedkhalid replied on at Permalink Reply
You can understand the whole code if you look into this page

\concrete\elements\files\search.php
this is the file manager page .

so we are getting each File ID value in (<%=file.fID%>) this is not a php code it is some javascript tempelate code i want this value in php and run my query