Jump to content
  • 0

Ошибка php


FLaShiQQ
 Share

Question

Доброго времени суток. Начал делать систему отзывов, но выводит он только 1 отзыв, а потом ошибка

"Warning: mysql_fetch_array() expects parameter 1 to be resource, array given in Z:\home\test1.ru\www\reviews.php on line 83<p>

<?php
include ("db.php");
if (isset($_GET['id'])) {$id = $_GET['id'];}
if (!isset($id)) {$id = 1;}

echo "<p class='title'>Отзывы о работе студии:</p><br/>";
$result = mysql_query ("SELECT * FROM comments WHERE id='$id'",$db);
if (mysql_num_rows($result) > 0)
{
$myrow = mysql_fetch_array($result);
do
{
printf
("
<table aling='center' class='post'>
<tr>
<td class='post_title'>
<p class='post_name'>Отзыв оставил(а): <strong>%s</strong><br/>
Дата: <strong>%s</strong></p>
</td>
</tr>

<tr>
<td class='text'>%s
</td>
</tr>
</table><br<br>

", $myrow["author"], $myrow["data"], $myrow["text"]);
}
while ($myrow = mysql_fetch_array($myrow));
}

?>

Выглядит это так http://gyazo.com/9e0...f17cb9f422704fd

83 строка - while ($myrow = mysql_fetch_array($myrow));

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0


while ($myrow = mysql_fetch_array($myrow));

вы даете при первом прохождение цикла верные данные через $myrow и присваиваете ей же полученные данные, потом из полученных данных пытаетесь получить следующий элемент, которого в этой переменной уже нет.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy