准备好的语句可能会导致内存泄漏?

Possible Memory Leak with prepared statements?

背景:

我正在尝试学习准备好的语句,但这个语句抛出了一个错误,我想了解如何修复。

项目 table 中的数据是由用户输入的,这就是为什么我为此也使用准备好的语句,而且...当然是实践..

我花了大约一个小时搜索这个网站,大多数网站都建议将内存限制更改为更高的值。我认为这不是必需的,因为我选择的 table行数很少..

查询目的:

用户加载页面,它会列出项目。从这里,他们可以使用他们通过参与我们 运行 的计划获得的积分购买所述物品。这是列出物品的查询..

这是错误:

Fatal error: Allowed memory size of 201326592 bytes exhausted (tried to allocate 4294967296 bytes) in (Removed, but is location of file) on line 80

第 80 行:

$Select_stmt2->bind_result($Item_Key, $Item_Image, $Item_Name, $Item_Amount, $Item_Describe);

额外信息:

在 header 期间,$conn 变量也是从第二个 configure.php 文件中提取的。我将显示它减去连接到服务器的信息。

//Connect to Database
$conn = new mysqli('localhost', 'Username', 'Password', 'Table Name');

代码:

//Item Points
            $Enabled = 'Enabled';

            $Select_Query2 = "SELECT Item_Key, Item_Image, Item_Name, Item_Amount, Item_Describe FROM Item WHERE Item_Status = ?";
            $Select_stmt2 = $conn->prepare($Select_Query2);
            $Select_stmt2->bind_param('s',$Enabled);
            $Select_stmt2->execute();

            $Select_stmt2->bind_result($Item_Key, $Item_Image, $Item_Name, $Item_Amount, $Item_Describe);
            if(!$Select_stmt2)
            {
                echo'Error: Selecting Items';
            }
            else
            {
                /* Code to display the data for line 80 on the website */
            }

你有blob列吗?数字 4294967296 表示您正在尝试为 blob 列的最大长度分配内存。它可能是错误但不是泄漏,罪魁祸首可能是 bind 语句。如果您有一个 blob 列并且它不断出错,请尝试在您的 select 语句中将其转换为 varchar。