Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/249.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.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
与过时的mysql\u查询接口混为一谈。在你对程序性风格投入太多之前,值得换一种。示例:$db=new mysqli(…)和$db->prepare(“…”)过程接口是PHP4时代的产物,当时引入了mysqliAPI,理想情况下不应该在新代码中使用。@ta_Php_Mysql - Fatal编程技术网

与过时的mysql\u查询接口混为一谈。在你对程序性风格投入太多之前,值得换一种。示例:$db=new mysqli(…)和$db->prepare(“…”)过程接口是PHP4时代的产物,当时引入了mysqliAPI,理想情况下不应该在新代码中使用。@ta

与过时的mysql\u查询接口混为一谈。在你对程序性风格投入太多之前,值得换一种。示例:$db=new mysqli(…)和$db->prepare(“…”)过程接口是PHP4时代的产物,当时引入了mysqliAPI,理想情况下不应该在新代码中使用。@ta,php,mysql,Php,Mysql,与过时的mysql\u查询接口混为一谈。在你对程序性风格投入太多之前,值得换一种。示例:$db=new mysqli(…)和$db->prepare(“…”)过程接口是PHP4时代的产物,当时引入了mysqliAPI,理想情况下不应该在新代码中使用。@tadman Ok,我将更新到这个结构,我甚至在我的大多数代码中都会使用它。你能帮我解答一下我的问题吗?通常“3最近”翻译成SELECT。。。从…起哪里ORDER BY x DESC LIMIT 3其中x是定义创建时间的DATETIME列。@tad


与过时的
mysql\u查询接口混为一谈。在你对程序性风格投入太多之前,值得换一种。示例:
$db=new mysqli(…)
$db->prepare(“…”)
过程接口是PHP4时代的产物,当时引入了
mysqli
API,理想情况下不应该在新代码中使用。@tadman Ok,我将更新到这个结构,我甚至在我的大多数代码中都会使用它。你能帮我解答一下我的问题吗?通常“3最近”翻译成
SELECT。。。从…起哪里ORDER BY x DESC LIMIT 3
其中
x
是定义创建时间的
DATETIME
列。@tadman是的,我知道,但问题不在查询中。问题是要创建一个按钮,当单击该按钮时,它将关闭我看到的查询信息,并显示上一个查询的信息。单独显示每个查询的日志警告:当使用
mysqli
时,您应该使用并向查询中添加任何数据。不要使用字符串插值或串联来完成此操作,因为您已经创建了严重的错误。切勿将
$\u POST
$\u GET
或任何类型的数据直接放入查询中,如果有人试图利用您的错误,这可能是非常有害的。注意:
mysqli
的面向对象界面明显不那么冗长,使代码更易于阅读和审核,并且不容易与过时的
mysql\u查询
接口混淆。在你对程序性风格投入太多之前,值得换一种。示例:
$db=new mysqli(…)
$db->prepare(“…”)
过程接口是PHP4时代的产物,当时引入了
mysqli
API,理想情况下不应该在新代码中使用。@tadman Ok,我将更新到这个结构,我甚至在我的大多数代码中都会使用它。你能帮我解答一下我的问题吗?通常“3最近”翻译成
SELECT。。。从…起哪里ORDER BY x DESC LIMIT 3
其中
x
是定义创建时间的
DATETIME
列。@tadman是的,我知道,但问题不在查询中。问题是要创建一个按钮,当单击该按钮时,它将关闭我看到的查询信息,并显示上一个查询的信息。单独显示每个查询的日志感谢您的回复,但我没有意识到如何在我的项目中应用它。我在问题中添加了我的解决方案,但它仍然不是我想要的答案,谢谢你的回答,但我没有意识到如何在我的项目中应用它。我在问题中补充了我的解决方案,但仍然不是我想要的
<a name="view2" id="<?php echo $row["Id"]; ?>" data-toggle="modal" href="#dataModal1" class="btn btn-primary view_data2" />EGA</a>

<div id="dataModal1" class="modal fade" style="width:1000px;">  
      <div class="modal-dialog" style="width:1000px;">  
           <div class="modal-content" style="width:1000px;">  
                <div class="modal-header" style="width:1000px;">  
                     <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> 
                     <h4 class="modal-title"><strong>Estado Geral e Autonomia</strong></h4>  
                </div> 
                <div class="container"></div>       
                <div class="modal-body" id="employee_detail1">  
                </div> 
                <div class="modal-footer">  
                     <a href="#" class="btn btn-danger" data-dismiss="modal">Sair</a>  
                </div>  
           </div>  
      </div>  
 </div> 

$(document).on('click', '.view_data2', function() {
  var employee_id1 = $(this).attr("Id");
  if (employee_id1 != '') {
    $.ajax({
      url: "./select2",
      method: "POST",
      data: {
        employee_id1: employee_id1
      },
      success: function(data) {
        console.log(data);
        $('#employee_detail1').html(data);
        $('#dataModal1').modal('show');
      }
    });
  }
});
if(isset($_POST["employee_id1"]))  
{ 
    $output = '';  

    $query = "SELECT * FROM centrodb.PsicUtentes WHERE centrodb.PsicUtentes.Id = '".$_POST["employee_id1"]."'"; 
    $result = mysqli_query($conn, $query);  
    $output;  
    while($row = mysqli_fetch_array($result))  
    {
        $output .= '
            <h4 class="modal-title">Identificação do Utente</h4>  
            <form method="post" id="insert_form2">
                <fieldset class="grupo">
                <table class="campo" cellspacing="10">
                 <tr>
                  <td>                      
                  <label>Data</label>  
                  <input type="text" id="Data1" name="Data" class="form-control" value="'.$row["Data"].'" style="width:150px;" />  
                  </td> 
                  <td>                      
                  <label>Código Utente</label>  
                  <input type="number" id="CodigoUtente1" name="CodigoUtente" value="'.$row["CodigoUtente"].'" class="form-control" style="width:100px;"/>  
                  </td>
                  <td>                        
                  <label>Nome Utente</label>  
                  <input type="text" id="Nome1" name="Nome" value="'.$row["Nome"].'" class="form-control" class="form-control" style="width:400px;"/>   
                  </td>
                  <td>  
                  <label>Data Nascimento</label>  
                  <input type="date" id="DataNasc1" name="DataNasc" value="'.$row["DataNasc"].'" class="form-control" style="width:150px;"/>   
                  </td>
              </tr>
            </table>
            </fieldset>   
            </form>                  
           ';  
    }  
    $output;  
    echo $output;  
}   
<script type="text/javascript"> 
$(document).ready(function(){ 

$('.conteudo').hide(); 

$('.exibir').each(function(i){ 
$(this).click(function(){ 
$('.conteudo').each(function(j){ 
if(i == j) $(this).show('slow'); 
}); 
}); 
}); 
$('.ocultar').each(function(i){ 
$(this).click(function(){ 
$('.conteudo').each(function(j){ 
if(i == j) $(this).hide('slow'); 
}); 
}); 
}); 
}); 
</script> 

if(isset($_POST["employee_id1"]))  
 { 
$output = '';  

$query = "SELECT * FROM centrodb.PsicUtentes WHERE centrodb.PsicUtentes.Id = '".$_POST["employee_id1"]."'"; 
      $result = mysqli_query($conn, $query);  
      $output;  
      while($row = mysqli_fetch_array($result))  
      {
      $output .= '

                <h4 class="modal-title">Identificação do Utente</h4>
<div> 
<a class="exibir" href="#">Ver</a>-- 
<a href="#" class="ocultar">Ocultar</a>
</div> 

<div class="conteudo"> 
<form method="post" id="insert_form2">
                        <fieldset class="grupo">
                        <table class="campo" cellspacing="10">
                         <tr>
                          <td>                      
                          <label>Data</label>  
                          <input type="text" id="Data1" name="Data" class="form-control" value="'.$row["Data"].'" style="width:150px;" />  
                          </td> 
                          <td>                      
                          <label>Código Utente</label>  
                          <input type="number" id="CodigoUtente1" name="CodigoUtente" value="'.$row["CodigoUtente"].'" class="form-control" style="width:100px;"/>  
                          </td>
                          <td>                        
                          <label>Nome Utente</label>  
                          <input type="text" id="Nome1" name="Nome" value="'.$row["Nome"].'" class="form-control" class="form-control" style="width:400px;"/>   
                          </td>
                          <td>  
                          <label>Data Nascimento</label>  
                          <input type="date" id="DataNasc1" name="DataNasc" value="'.$row["DataNasc"].'" class="form-control" style="width:150px;"/>   
                          </td>
                          </tr>
                        </table>
                        </fieldset>   
                        </form>    

<div>
';  
      }  
      $output;  
      echo $output;  
 }
if (isset($_POST["action"])) {
        $action = $_POST["action"];
        switch ($action) {
            case 'SLC':
                if (isset($_POST["id"])) {
                    $id = $_POST["id"];
                    if (is_int($id)) {
                        $query = "select * from client where clientId = '$id' ";
                        $update = mysqli_query($mysqli, $query);
                        $response = array();
                        while($row = mysqli_fetch_array($update)){
                        .......
                        // you need to fill the response array here with the info you 
                        //want to display and send it with json encode later

                        }

                       echo json_encode($response);
                    }
                }
                break;

        }
    }
function getInfo(id) {

   return $.ajax({
        type: "POST",
        url: "getInfo.php",
        data: { action: "SLC", id:id }
    })

}
getInfo(id).done(function(response){
var data=JSON.parse(response);
if (data != null) {
$('#form_id').trigger("reset");
//fill your modal form using your data and display the modal after reset the form
$("#modal").show();
}
})