<?php
$pdo = new PDO("mysqli:host=localhost;dbname=alladin", 'root', '');
$output = '';
if(isset($_POST["query"]))
{
$search = mysqli_real_escape_string($pdo, $_POST["query"]);
$query = "
SELECT * FROM orders
WHERE orderNumber LIKE '%".$search."%'
OR orderDate LIKE '%".$search."%'
OR requiredDate LIKE '%".$search."%'
OR status LIKE '%".$search."%'
";
}
else
{
}
$result = $pdo->query($query = "SELECT * FROM orders ORDER BY orderNumber ");
我不明白如何将mysqli_real_escape_string更改为PDO。我曾尝试对PDO进行一些更改,但恐怕mysqli真正的转义字符串括号($ pdo,$ _ POST [“ query”])会影响我的预期结果。