Цитата |
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in Z:\home\phpsite\www\admin\edit_part.php on line 32 |
<?
if(!isset($_GET['id']))
{
$result = mysql_query("SELECT title,id FROM partners");
$myrow = mysql_fetch_array($result);
do
{
printf("<p><a href='edit_part.php?id=%s'>%s</a></p>",$myrow["id"],$myrow["title"]);
}
while($myrow = mysql_fetch_array($result));
}
else
{
$result = mysql_query("SELECT * FROM partners WHERE id=$id");
$myrow = mysql_fetch_array($result); /* <----------------------------------- 32 линия */
print <<<HERE
<p><form id="form1" name="form1" method="post" action="add_part.php">
<p>
<label for="title">Введите название</label>
<br />
<input value="$myrow[$title]" type="text" name="title" id="title" />
<br />
<label for="text">Введите текст</label>
<br />
<textarea name="text" id="text" cols="60" rows="15">$myrow[$text]</textarea>
<br />
<label for="author">Введите автора</label>
<br />
<input type="text" name="author" id="author" />
<input name="id" type="hidden" value="$myrow[$id]" />
<br />
<br />
<input type="submit" name="submit" id="submit" value="Сохранить изменения" />
</form></p
HERE;
}
?>
<?
if(!isset($_GET['id']))
{
$result = mysql_query("SELECT title,id FROM partners");
$myrow = mysql_fetch_array($result);
while($myrow = mysql_fetch_array($result))
{
echo("<p><a href='edit_part.php?id=".$myrow['id']."'>".$myrow['title']."</a></p>");
}
}
else
{
$id=(int)isset($_GET['id'];
$result = mysql_query("SELECT * FROM partners WHERE id=$id");
$myrow = mysql_fetch_array($result);
print <<<HERE
<p><form id="form1" name="form1" method="post" action="add_part.php">
<p>
<label for="title">Введите название</label>
<br />
<input value="$myrow[$title]" type="text" name="title" id="title" />
<br />
<label for="text">Введите текст</label>
<br />
<textarea name="text" id="text" cols="60" rows="15">$myrow[$text]</textarea>
<br />
<label for="author">Введите автора</label>
<br />
<input type="text" name="author" id="author" />
<input name="id" type="hidden" value="$myrow[$id]" />
<br />
<br />
<input type="submit" name="submit" id="submit" value="Сохранить изменения" />
</form></p
HERE;
}
?>
<?
if(!isset($_GET['id']))
{
$result = mysql_query("SELECT title,id FROM partners");
$myrow = mysql_fetch_array($result);
while($myrow = mysql_fetch_array($result))
{
echo("<p><a href='edit_part.php?id=".$myrow['id']."'>".$myrow['title']."</a></p>");
}
}
else
{
$id=(int)isset($_GET['id'];
$result = mysql_query("SELECT * FROM partners WHERE id=$id");
$myrow = mysql_fetch_array($result);
echo '<p><form id="form1" name="form1" method="post" action="add_part.php">
<p>
<label for="title">Введите название</label>
<br />
<input value="'.$myrow['title'].'" type="text" name="title" id="title" />
<br />
<label for="text">Введите текст</label>
<br />
<textarea name="text" id="text" cols="60" rows="15">'.$myrow['text'].'</textarea>
<br />
<label for="author">Введите автора</label>
<br />
<input type="text" name="author" id="author" />
<input name="id" type="hidden" value="'.$myrow['id'].'" />
<br />
<br />
<input type="submit" name="submit" id="submit" value="Сохранить изменения" />
</form></p>';
}
?>
$id=(int)isset($_GET['id'];