-1
我正在制作照片库,并且每张照片都可以看到该照片上有多少评论。我已经工作像它的代码应该只是如果已有0条评论这将给“未定义偏移误差:2”
“未定义失调误差:3”
“未定义失调误差:4”
“未定义偏置误差:5'
等PHP未定义偏移
这是检查有多少评论有代码: (reacties =评论)
// check how many comments every photo has.
$reacties;
$query = "select foto from fotosreacties where boek = '" . $_GET['boek'] . "'";
if($result = mysql_query($query)){
while ($r = mysql_fetch_array($result)){
while ($foto = current($fotoArray)) {
if ($foto==$r["foto"]){
$key = key($fotoArray);
} // end if
next($fotoArray);
} // end while
if(!isset($reacties[$key])){
$reacties[$key] = 1;
} // end if
else {
$reacties[$key]++;
} // end else
reset($fotoArray);
} // end while
} // end if
这是显示图片和数字代码评论数:
for($i=$begin; $i < $eind; $i++){
$thumb = str_replace($path2, $thumbPath, $fotoArray[$i]);
echo "<td align='center'><a href='" . $_SERVER['PHP_SELF'] . "?page=album&boek=" . $originalPath . "&fotoID=" . $i . "'><img border='0' src='" . $thumb . "' height='100'><br>";
echo "<small>reacties (";
if($reacties[$i]==0){
echo "0";
} // end if
else {
echo $reacties[$i];
} // end else
echo ")</small>";
echo "</a></td>";
$fotonr++;
if($fotonr == ($clm + 1)){
echo "</tr>\n<tr>";
$fotonr = 1;
} // end if
如果有人知道我做错了什么和/或知道如何解决这个问题,那就太好了!
Thnx的答案和其他技巧,但我仍然无法得到它的工作。你能否在代码中向我展示你的解决方案? – Daanvn