gpt4 book ai didi

php - 从表中选择但从值中删除空格

转载 作者:太空宇宙 更新时间:2023-11-03 12:14:11 25 4
gpt4 key购买 nike

我正在尝试使用 PHP/MySQL 从表中进行选择。

我要运行:

$stmt = $pdo_conn->prepare("SELECT * from customer where phone = :phone ");
$stmt->execute(array(':phone' => $res));
$records = $stmt->fetchAll(PDO::FETCH_ASSOC);

在客户表中,phone 等于 00000 00 00 00

但是 $res 等于 00000000000

我怎样才能确保它们匹配?

最佳答案

您可以使用 replace... 来替换空格。

where replace(phone, ' ', '') = :phone

关于php - 从表中选择但从值中删除空格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22906506/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com