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
Php 在索引页中读取并显示数据库中txt文件的内容_Php_Html_Mysql_Mysqli_Php 5.3 - Fatal编程技术网

Php 在索引页中读取并显示数据库中txt文件的内容

Php 在索引页中读取并显示数据库中txt文件的内容,php,html,mysql,mysqli,php-5.3,Php,Html,Mysql,Mysqli,Php 5.3,在php中,如何使索引页从保存在TXT文件夹中的文本文件中读取,并且文本名称已经保存在mysqli数据库中,这是php和数据库的新手。 这是数据库表 从SQL获取文本文件名,然后使用获取文本文件内容 $servername = "localhost"; $username = "username"; $password = "password"; $dbname = "myDB"; // Create connection $connection= new mysqli($servername

在php中,如何使索引页从保存在TXT文件夹中的文本文件中读取,并且文本名称已经保存在mysqli数据库中,这是php和数据库的新手。 这是数据库表


从SQL获取文本文件名,然后使用获取文本文件内容

$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "myDB";

// Create connection
$connection= new mysqli($servername, $username, $password, $dbname);
    $query = mysqli_query($connection, "SELECT name FROM new_record");
    while ($row = mysqli_fetch_array($query)) {
        $fileName = $row['name'];
        $fileContents = file_get_contents("/TXT/$fileName");
        echo $fileContents;
    }

你试过什么了吗?php mysql从数据库中选择数据这不是“适合我的代码”。你自己用谷歌搜索一下,然后问是否有stuckhes要求从数据库中获取他问的是,当文本文件名在SQL数据库中时,如何使索引页从保存到TXT文件夹的文本文件中读取,以及如何从db中获取文本文件名?