|
|
|
|
|
для: amsokol
(07.03.2013 в 00:01)
| | Что, никто помоч не может, АУУУУУУ! | |
|
|
|
|
|
|
| Всем привет! Ребят подскажите пожалуйста, что не так.
Есть форма, данные в ней выведены из базы при помощи цикла. Необходимо заносить изменения в базу только значения одной переменной при нажатии на sabmit, но есть загвоздка, ни как немогу прописать что записывать нужно только ту переменную, в которой появились изменения. Весь день потерял в эксперементах, но всё напрасно :(
<?php
error_reporting(E_ALL);
$ap = mysql_query("SELECT * FROM `url` WHERE `user`='$name' ORDER BY `id`")or die(mysql_error());
$row = mysql_fetch_array($ap);
$data=date("j, n, Y");
if(isset($_POST['upr']))
{
if($_POST['upr']=="akk-smysites")
{
$im = key($_POST['sel']); //определяем id массива из цикла который будем изменять
$newpryce=$_POST['date'][$im];
//подключение к базе и изменение ставок
$uppr = mysql_query("UPDATE url SET price='$newpryce' WHERE `id`='$im'")or die(mysql_error());
}
else
{
echo'<br><p align="center"><b><font color="red">Неверный формат запроса!</font></b></p>';
}
}
?>
<br><p align="center"class="main"><b><font color="#800000">Мои web ресурсы.</font></b></p>
<br>
<h3 align="center"class="main">Управление сайтами</h3>
<form action="<?=$servname;?>users/office.php?ci=my_url" method="post" name="es" id="es">
<input type="hidden" name="upr" value="akk-smysites">
<table width="90%" cellspacing="0" cellpadding="0">
<tr>
<td width="30"><a href="index.php?cf=akk-addmysites"><img onMouseOver="show_help('hi1')" onMouseOut="hide_help('hi1')" src="<?=$servname;?>template/images/esurl.jpg" width="20" height="20"align="middle"/></a></td><td class="main"><a href=""class="main">Добавить новый сайт</a></td></tr>
</table><br>
--------------------------------------------------------------------------------------
<table border=""width="600"cellspacing="0">
<tr>
<td width="5%"bgcolor="#BDCED6" align="center" class="main">ID</td>
<td width="42%"bgcolor="#BDCED6" align="center" class="main">Сайт</td>
<td width="5%" bgcolor="#BDCED6" align="center" class="main">Статус <font color="#d40202" class="main">*</font></td>
<td width="5%"bgcolor="#BDCED6" align="center" class="main">За клик <font color="#d40202">*</font><br>(руб.)
</td>
<td width="15%"bgcolor="#BDCED6" align="center" class="main">Кликов <font color="#d40202">*</font>
<table width="70px" cellspacing="0">
<tr>
<td width="50%"bgcolor="#BDCED6" align="center" class="main">сегодня</td>
<td width="50%"bgcolor="#BDCED6" align="center" class="main">вчера</td>
</tr>
</table>
</td>
<td width="8%" bgcolor="#BDCED6" align="center" class="main">Функции</td>
</tr>
<?
do
{
if($row['moder']==0){$img="nan.png"; $hi="show_help('hi3')";$out="hide_help('hi3')";}
if($row['moder']==1){$img="esurl.jpg"; $hi="show_help('hi4')";$out="hide_help('hi4')";}
if($row['moder']==2){$img="nouurl.jpg"; $hi="show_help('hi5')";$out="hide_help('hi5')";}
echo' <tr >
<td align="center" class="main">'.$row['id'].'</td>
<input type="hidden" name="sel['.$row['id'].']" value="" />
<td class="main">
<a href="'.$row['surl'].'">
<img onMouseOver="show_help(\'hi2\')" onMouseOut="hide_help(\'hi2\')" src="'.$servname.'template/images/info.gif" width="16" height="16" border="0"></a> <font style="font-size: 13px;"></font> <a href="" target="_blank">'.$row['sname'].'</a></td>
<td align="center"><img onMouseOver='.$hi.' onMouseOut='.$out.'
src="'.$servname.'template/images/'.$img.'" width="14" height="14"/></td>
<td align="center" nowrap>
<input type="text" name="date['.$row['id'].']" value="'.$row['price'].'" size="3"> <a href=""><img onMouseOver="show_help(\'hi6\')" onMouseOut="hide_help(\'hi6\')" src="'.$servname.'template/images/stavki.jpg" width="16" height="18" border="0"></a></td>
<td class="main">
<table width="80"cellspacing="0">
<tr>
<td width="50%" align="center" class="main"><a href="">0</a></td>
<td width="50%" align="center" class="main"><a href="">0</a></td>
</tr>
</table>
</td>
<td align="center">
<table cellspacing="1" cellpadding="0">
<tr>
<td><a href=""><img onMouseOver="show_help(\'hi7\')" onMouseOut="hide_help(\'hi7\')" src="'.$servname.'template/images/window.jpg" alt="Получить код,_для блока ссылок" width="19" height="16" border="0" align="middle"></a></td>
<td><a href=""><img onMouseOver="show_help(\'hi8\')" onMouseOut="hide_help(\'hi8\')" src="'.$servname.'template/images/setting.jpg" alt="Настроить блок ссылок" width="16" height="16" border="0" align="middle"></a></td>
<td><a href=""><img onMouseOver="show_help(\'hi9\')" onMouseOut="hide_help(\'hi9\')" src="'.$servname.'template/images/uses.jpg" alt="Редактировать сайт" width="16" height="16" border="0" align="middle"></a></td>
<td><a href=""><img onMouseOver="show_help(\'hi10\')" onMouseOut="hide_help(\'hi10\')" src="'.$servname.'template/images/nouurl.jpg" alt="Удалить сайт" width="16" height="16" border="0" align="middle"></a></td>
</tr>
</table>';
}
while ($row = mysql_fetch_array($ap));
?>
</td>
</tr>
</tr>
</table>
</td>
</tr>
<tr >
<td> </td>
<td colspan="3" align="center">
<input type="submit" value="Сохранить ставки"></td> | |
|
|
|
|