javascript - How to fetch all the results from MySQL table? -


i trying fetch results phpadmin mysql table. problem using below code php , angular js, first row gets fetched everytime. suppose there 5 entries in table. whats happens first 1 getting displayed 5 times on website. when php echo (commented out in code), returns result table, not working angular js.

i using js fuzzy search library have not provided here due space issues. here code otherwise :

</table>         <?php            $result = mysql_query("select * user_files order id desc");             while($row = mysql_fetch_array($result)){            $id1 = $row['id'];           $name = $row['user_file_name'];           //echo $name.'<br/>';                       ?>  <div class="container" ng-init="books=[{book:'<?php echo $name;?>',author:'<?php echo $id1;?>'}]"> </div>                                   <tr ng-repeat="bookinfo in books | filter:booktext | orderby:'book'">                                      <td style="color: black;">{{ bookinfo.book }} - {{ bookinfo.author | lowercase}}</td>  <td style="color: black;" align="center">size</td> <td style="color: black;" align="center">type</td>  <td style="color: black;" align="center" width=90%>  <input type="button" name="read" value="read"></td>  <td style="color: black;" align="center" width=90%> <input type="button" name="write" value="write"></td>  <td style="color: black;" align="center" width=90%> <input type="button" name="download" value="download"></td>  <td style="color: black;" align="center" width=90%> <input type="button" name="share" value="share"></td>  </tr> 

yes because initializing array as

ng-init="books=[{book:'<?php echo $name;?>',author:'<?php echo $id1;?>'}] 

after compiles showing like

ng-init="books=[{book:'bookname1',author:'authorid1'}] 

then there 1 book available ng-repeat

so have is,

<?php    $result = mysql_query("select * user_files order id desc");     $dataarr = array();         // detail array   while($row = mysql_fetch_array($result)){       $id1 = $row['id'];       $name = $row['user_file_name'];       array_push($dataarr , array("book"=>$name , "author"=>$id1));   }  ?>  ... ng-init="books=<?php echo json_encode($dataarr); ?>"> 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -