Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 用于从sql获取数据的按钮_Php_Html - Fatal编程技术网

Php 用于从sql获取数据的按钮

Php 用于从sql获取数据的按钮,php,html,Php,Html,我已经在我的数据库中创建了两个表,1.loginacc(保持登录信息(LoginID、密码和权限)2.borrow(拥有登录借来的图书,userid) 下面是代码:我已经获得了所有的用户id,除了我从数据库loginacc获得的每个用户之外,它还有一个名为“获取信息”的按钮。当我单击它时,它的顺序是“select*from borrow where userid=(显示的loginid) 为什么不使用锚(link)来发送loginID,而不是使用按钮,这将很简单。据我所知,您的问题如下所示

我已经在我的数据库中创建了两个表,1.loginacc(保持登录信息(LoginID、密码和权限)2.borrow(拥有登录借来的图书,userid)

下面是代码:我已经获得了所有的用户id,除了我从数据库loginacc获得的每个用户之外,它还有一个名为“获取信息”的按钮。当我单击它时,它的顺序是“select*from borrow where userid=(显示的loginid)

为什么不使用锚(link)来发送loginID,而不是使用按钮,这将很简单。据我所知,您的问题如下所示

  echo "<table border=5 cellpadding=10>";
  echo "<tr><th></th><th>ac</th><th>pw</th><th>per</th><th></th></tr>";

  while($row = mysql_fetch_array($results)) { 

    echo "<tr><td>
    <a href='searchtable.php?lid=$row[0]'>get information</a></td>

    <td><input type=text id='row0' name='row0' value='$row[0]' /></td><td><input type=text id='row1' name='row1' value='$row[1]' /></td>
              <td><input type=text id='row2' name='row2' value='$row[2]' /></td><td><input type='submit' name='button' value='change' /></td></tr>";

  }

  echo "</table>";
echo”“;
回声“acpwper”;
而($row=mysql\u fetch\u数组($results)){
回声“
";
}
回声“;
现在在下一页,即searchtable.php中,使用get方法获取id并执行查询

<?php
    $loginId = $_GET['lid'];

    $con = mysql_connect("127.0.0.1","root","password");

  mysql_select_db("babytradeapps");

  $sql = "Select * from borrow where userid = $loginId";    

  $results = mysql_query($sql,$con);
  $final_result = mysql_fetch_array($results);
  print_r($final_result);
  // Manipulate view with the result 

?>

<?php
    $loginId = $_GET['lid'];

    $con = mysql_connect("127.0.0.1","root","password");

  mysql_select_db("babytradeapps");

  $sql = "Select * from borrow where userid = $loginId";    

  $results = mysql_query($sql,$con);
  $final_result = mysql_fetch_array($results);
  print_r($final_result);
  // Manipulate view with the result 

?>