我有从Mysql到mysqli(程序)的转换问题。 在使用mysqli设置后,两段看起来基本相同的代码工作方式不同。
有第一个。工作
<?php
$dotaz = 'SELECT *
FROM portfolio
WHERE stav = "normal"
ORDER BY poradi ASC';
$vysledky = mysqli_query($link, $dotaz);
while($radek = mysqli_fetch_array($vysledky)) {
extract($radek);
$dotaz2 = 'SELECT url, alt_cs
FROM img
WHERE category="items" and id_item="'.$id.'" and thumb=1
ORDER BY id DESC';
$vysledky2 = mysqli_query($link,$dotaz2);
while($radek2 = mysqli_fetch_array($vysledky2)) {
extract($radek2);}
echo '
<a href="cs/portfolio/'.$id.'">
<div class="select">
<img src="'.$url.'" class="select-img" alt="'.$alt_cs.'">
<div class="select-popis">
<h2>'.$name_cs.'</h2>
<p class="mini">'.$category_cs.'</p>
</div>
</div>
</a>
';
}
?>
还有第二个,不工作。
警告:mysqli_query()期望参数1为mysqli,字符串在第62行的D:\ 00 FLEKAL.COM \ cs \ download-list.php中给出
<?php
$dotaz = 'SELECT *
FROM download
ORDER BY id DESC';
$vysledky = mysqli_query($link, $dotaz);
while($radek = mysqli_fetch_array($vysledky)) {
extract($radek);
$dotaz2 = 'SELECT url, alt_cs
FROM img
WHERE category="down" and id_item="'.$id.'" and thumb = 1
ORDER BY id DESC';
$vysledky2 = mysqli_query($link,$dotaz2);
while($radek2 = mysqli_fetch_array($vysledky2)) {
extract($radek2);}
echo '
<a href="cs/download/'.$id.'">
<div class="select-img-down" style="background-image: url('.$url.')"></div>
</a>
';
}
?>
谢谢。