SELECT SUBSTRING(LEFT(configuration, LOCATE('abhol_firma', configuration) -30), LOCATE('treuhand_betrag', configuration) +22, 100) FROM tl_iso_product_collection_item WHERE LOCATE('abhol_firma', configuration) > 0 AND LOCATE('treuhand_betrag', configuration) > 0 ORDER BY id DESC LIMIT 1
所以基本上我需要将此代码实现到 PHP 文件中并显示结果。到目前为止,我的代码如下所示:
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$connection = mysqli_connect('localhost', 'user', 'pw', 'db');
$query = "SELECT SUBSTRING(LEFT(configuration, LOCATE('abhol_firma', configuration) -30), LOCATE('treuhand_betrag', configuration) +22, 100) FROM tl_iso_product_collection_item WHERE LOCATE('abhol_firma', configuration) > 0 AND LOCATE('treuhand_betrag', configuration) > 0 ORDER BY id DESC LIMIT 1";
$result = mysqli_query($connection, $query);
if($result === FALSE) {
echo mysqli_error($connection);
} else
while($row = mysqli_fetch_array($result)){
echo $row['configuration'];
}
mysqli_close($connection);
?>
tl_iso_product_collection_item 表:http ://puu.sh/mUf65/b1498aa7fa.png
结构: http: //puu.sh/mUf78/f25448e1d7.png
当我尝试执行此操作时,会出现以下消息:
Notice: Undefined index: configuration on line 12
我确实尝试了所有方法,但我只是不知道问题可能出在哪里。任何人都可以帮忙吗?提前致谢。