访问功能和从URL更改可验证

时间:2018-05-23 11:09:26

标签: php function url methods

我想访问此功能并从URL更改变量我该怎么做。我试着回应一些事情及其工作 http://test.local/UUser.php

<?php echo '<p>'. 'Hello Husam' . '</p>'; ?>

但我如何在UUser.php中访问此功能。 例如,我需要更改$ order =&#34; ASC&#34;到$ order =&#34; DESC&#34;。

public function getBooks($start = 0, $limit = 2, $order = "ASC")
 {

   $sql_start = $start * $limit;
   $sql_limit = $limit;
   $sql_order_by = $order;

   $query = "SELECT Library.nameOfBook, userBook.book_id, userBook.user_id FROM loginUser JOIN userBook JOIN Library ON userBook.user_id = loginUser.id AND userBook.book_id = Library.id WHERE loginUser.username=:username ORDER BY Library.nameOfBook $sql_order_by LIMIT $sql_start, $sql_limit";
   $statment = $this->db->prepare($query);
   $statment->execute([
       ':username' => $this->username
   ]);
   $result = $statment->fetchAll();

  echo "<table id='myTable' border='1'>

  <tr>
   <th><a id='sorter' href='#'>Books</a></th>
   <th>Action</th>
   </tr>";
   foreach($result as $row){
       echo "<tr>";
       echo "<td>" . $row['nameOfBook'] . "</td>";
       echo "<td>" ."<input type='submit' id='delete".$row['book_id']."-".$row['user_id']."' onclick='deleteBook(this)' name='delete' value='Delete'>" . "</td>";
       echo "</tr>";
   }

   echo "</table>";
   echo "";
   return count($result);
   echo '<p>'. 'Hello Husam' . '</p>';
 }

0 个答案:

没有答案