• <bdo id='F2DWp'></bdo><ul id='F2DWp'></ul>

    <tfoot id='F2DWp'></tfoot>
  • <i id='F2DWp'><tr id='F2DWp'><dt id='F2DWp'><q id='F2DWp'><span id='F2DWp'><b id='F2DWp'><form id='F2DWp'><ins id='F2DWp'></ins><ul id='F2DWp'></ul><sub id='F2DWp'></sub></form><legend id='F2DWp'></legend><bdo id='F2DWp'><pre id='F2DWp'><center id='F2DWp'></center></pre></bdo></b><th id='F2DWp'></th></span></q></dt></tr></i><div id='F2DWp'><tfoot id='F2DWp'></tfoot><dl id='F2DWp'><fieldset id='F2DWp'></fieldset></dl></div>

      <legend id='F2DWp'><style id='F2DWp'><dir id='F2DWp'><q id='F2DWp'></q></dir></style></legend>

        <small id='F2DWp'></small><noframes id='F2DWp'>

        使用 mysqli 获取行

        时间:2023-07-29

          <tfoot id='QcHK3'></tfoot>

            <legend id='QcHK3'><style id='QcHK3'><dir id='QcHK3'><q id='QcHK3'></q></dir></style></legend>
            • <bdo id='QcHK3'></bdo><ul id='QcHK3'></ul>

                  <tbody id='QcHK3'></tbody>

                <i id='QcHK3'><tr id='QcHK3'><dt id='QcHK3'><q id='QcHK3'><span id='QcHK3'><b id='QcHK3'><form id='QcHK3'><ins id='QcHK3'></ins><ul id='QcHK3'></ul><sub id='QcHK3'></sub></form><legend id='QcHK3'></legend><bdo id='QcHK3'><pre id='QcHK3'><center id='QcHK3'></center></pre></bdo></b><th id='QcHK3'></th></span></q></dt></tr></i><div id='QcHK3'><tfoot id='QcHK3'></tfoot><dl id='QcHK3'><fieldset id='QcHK3'></fieldset></dl></div>

                <small id='QcHK3'></small><noframes id='QcHK3'>

                  本文介绍了使用 mysqli 获取行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  这是一个简单的代码.每次上传文件时,我都想在数据库中保留一条记录.每次上传任何文件时,我都希望用户从数据库中以串行方式查看他/她的所有上传文件.上传文件时的记录保存工作正常.但是在获取包含所有上传文件信息的表时出现问题.

                  its a simple code. I want to keep a record in the database each time when a file is being uploaded. And when each time any file is being uploaded I want the user to see he/her's all uploaded files in a serial from the database. The record keeping while uploading file works fine. But the problem appears while fetching the table containing all the uploaded file information.

                  //connetion code 
                  $con = mysqli_connect("localhost", "root", "", "sss");
                  
                  if (mysqli_connect_errno()) 
                  {
                      printf("Connect failed: %s
                  ", mysqli_connect_error());
                      exit();
                  }
                  
                  //file upload code
                  move_uploaded_file($_FILES["file"]["tmp_name"],"C:/xampp/htdocs/" . $_FILES["file"]["name"]);
                  mysqli_query($con, "INSERT INTO uploads ( filename, uploaded_on) VALUES ( '{$_FILES['file']['name']}', NOW());");
                  echo "Stored in: " . "C:/xampp/htdocs/" . $_FILES["file"]["name"];
                  
                  //fetch rows 
                  $result =mysqli_query($con, "select * from uploads");
                  
                  while ($row = mysqli_fetch_array($result))
                  {
                      printf ("%s
                  ", $row);
                  }
                  
                  mysqli_close($con);
                  }
                  

                  我能感觉到编码存在一些严重的问题.这是我第一次在 mysqli 中工作,之前我曾经使用 mysql 进行编码.需要帮助以了解实际问题和解决方案.

                  I can feel that there are some serious problem in coding. This is my first time working in mysqli, before I used to code using mysql. need help to know the actual problem and the solution.

                  它返回这个,

                  Notice: Array to string conversion in C:xampphtdocssssupload_file.php on line 68
                  Array
                  
                  Notice: Array to string conversion in C:xampphtdocssssupload_file.php on line 68
                  Array
                  
                  Notice: Array to string conversion in C:xampphtdocssssupload_file.php on line 68
                  Array
                  

                  但不幸的是,这段代码是庞大代码的一部分.所以这里的第 68 行是 $result = mysqli_query($con, "select * from uploads"); 开始的那一行.

                  but unfortunately this code is a part of a huge code. so here line 68 is the line where the $result = mysqli_query($con, "select * from uploads"); starts.

                  推荐答案

                  $result =mysqli_query($con, "select * from uploads");
                  while ($row = mysqli_fetch_assoc($result))
                     {
                        printf ("%s
                  ", $row['column_name_1']);
                        printf ("%s
                  ", $row['column_name_2']);
                        printf ("%s
                  ", $row['column_name_3']);
                     }
                  mysqli_close($con);
                  

                  但是您应该认真考虑查看代码的安全性.

                  But you should seriously consider looking at the security of your code.

                  这篇关于使用 mysqli 获取行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:对象无法在 MySQLi PHP 中转换为字符串 下一篇:警告:mysqli_query() 期望参数 1 为 mysqli,第 14 行

                  相关文章

                  最新文章

                    <i id='fRtdG'><tr id='fRtdG'><dt id='fRtdG'><q id='fRtdG'><span id='fRtdG'><b id='fRtdG'><form id='fRtdG'><ins id='fRtdG'></ins><ul id='fRtdG'></ul><sub id='fRtdG'></sub></form><legend id='fRtdG'></legend><bdo id='fRtdG'><pre id='fRtdG'><center id='fRtdG'></center></pre></bdo></b><th id='fRtdG'></th></span></q></dt></tr></i><div id='fRtdG'><tfoot id='fRtdG'></tfoot><dl id='fRtdG'><fieldset id='fRtdG'></fieldset></dl></div>
                        <bdo id='fRtdG'></bdo><ul id='fRtdG'></ul>
                    1. <tfoot id='fRtdG'></tfoot>
                    2. <small id='fRtdG'></small><noframes id='fRtdG'>

                    3. <legend id='fRtdG'><style id='fRtdG'><dir id='fRtdG'><q id='fRtdG'></q></dir></style></legend>