我有下一个没有显示结果的代码:
<?php include ("access.php");
$corpustitle = "Korpus Bilingüe Alemany-Català (de)";
$result = mysqli_query($dbiac, "SELECT corpus FROM corpus_info WHERE title = '$corpustitle'") or die(mysqli_error($dbiac));
while($row = mysqli_fetch_array($result)){
echo $row['corpus']."<br>";
} ?>
但是如果我从查询中取出WHERE语句,我会得到下一个结果:
$result = mysqli_query($dbiac, "SELECT corpus FROM corpus_info") or die(mysqli_error($dbiac));
如果我在phpmyadmin进行原始查询,我会得到我正在寻找的结果:
答案 0 :(得分:0)
是的,在@ delboy1978uk评论之后我在查询之前添加了这一行,这就产生了不同:
mysqli_set_charset($dbiac, 'utf8');
所以整个代码现在是:
<?php include ("access.php");
$corpustitle = "Korpus Bilingüe Alemany-Català (de)";
mysqli_set_charset($dbiac, 'utf8');
$result = mysqli_query($dbiac, "SELECT corpus FROM corpus_info WHERE title = '$corpustitle'") or die(mysqli_error($dbiac));
while($row = mysqli_fetch_array($result)){
echo $row['corpus']."<br>";
} ?>
...谢谢