Witam
Poniżej podaje jak mam kod do update bazy. Otóż to. Pobiera mi wszystkie dane z bazy, ale niestety nie zmienia wpisów, które edytowałem.
NIe wiem gdzie tkwi problem. Czy możecie pomóc mi i zobaczyć gdzie tkwi problem.
Pozdrawiam
$pokaz = $_GET['pokaz'];
$sql="select * from atrakcje where id='$pokaz'";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
if(isset($_GET['changes'])):
{
$id = $_GET['id'];
$kat = $_GET['kat'];
$tytul =$_GET['tytul'];
$ul = $_GET['ul'];
$miasto = $_GET['miasto'];
$gmina = $_GET['gmina'];
$powiat = $_GET['powiat'];
$wojewodztwo = $_GET['wojewodztwo'];
$opis = $_GET['opis'];
$www = $_GET['www'];
$zdjecie = $_GET['zdjecie'];
$gmx = $_GET['gmx'];
$gmy = $_GET['gmy'];
$counter = $_GET['counter'];
$sql="update atrakcje set id='$id' where id='$pokaz'";
mysql_query($sql);
$sql="update atrakcje set kat='$kat' where id='$pokaz'";
mysql_query($sql);
$sql="update atrakcje set tytul='$tytul' where id='$pokaz'";
mysql_query($sql);
$sql="update atrakcje set ul='$ul' where id='$pokaz'";
mysql_query($sql);
$sql="update atrakcje set miasto='$miasto' where id='$pokaz'";
mysql_query($sql);
$sql="update atrakcje set gmina='$gmina' where id='$pokaz'";
mysql_query($sql);
$sql="update atrakcje set powiat='$powiat' where id='$pokaz'";
mysql_query($sql);
$sql="update atrakcje set wojewodztwo='$wojewodztwo' where id='$pokaz'";
mysql_query($sql);
$sql="update atrakcje set opis='$opis' where id='$pokaz'";
mysql_query($sql);
$sql="update atrakcje set www='$www' where id='$pokaz'";
mysql_query($sql);
$sql="update atrakcje set zdjecie='$zdjecie' where id='$pokaz'";
mysql_query($sql);
$sql="update atrakcje set gmx='$gmx' where id='$pokaz'";
mysql_query($sql);
$sql="update atrakcje set gmy='$gmy' where id='$pokaz'";
mysql_query($sql);
$sql="update atrakcje set counter='$counter' where id='$pokaz'";
mysql_query($sql);
echo "<p align=\"center\">Twoje dane zostały zmienione.</p>";
echo $row['id'];
}
else:
{
### wywietlenie wpisu #######################################################?>
<form action="edycja.php" method="get">
<table width=450 align="center">
<tr><td align="center" height=0><p>Tutaj możesz zmienić i aktualizować swoje dane:</table>
<table width="750" align="center">
<tr>
<td>
<tr>
<td class="label">Kategoria:</td><td><input class="long" type="text" name="id" value="
<? echo $row['id']; ?>">
</tr><br/>
<tr>
<td class="label">Kategoria:</td><td><input class="long" type="text" name="kat" value="
<? echo $row['kat']; ?>">
</tr><br/>
<tr>
<td class="label">Tytul:</td><td><input class="long" type="text" name="tytul" value="
<? echo $row['tytul']; ?>">
</tr><br/>
<tr>
<td class="label">Ulica:</td><td><input class="long" type="text" name="ul" size="40" value="
<? echo $row['ul']; ?>">
</tr><br/>
<tr>
<td class="label">miasto:</td><td><input class="long" type="text" name="miasto" value="
<? echo $row['miasto']; ?>">
</tr><br/>
<tr>
<td class="label">gmina:</td><td><input class="long" type="text" name="gmina" value="
<? echo $row['gmina']; ?>">
</tr><br/>
<tr>
<td class="label">powiat:</td><td><input class="long" type="text" name="powiat" value="
<? echo $row['powiat']; ?>">
</tr><br/>
<tr>
<td class="label">wojewodztwo:</td><td><input class="long" type="text" name="wojewodztwo" value="
<? echo $row['wojewodztwo']; ?>">
</tr><br/>
<tr>
<td class="label">opis:</td><td><input class="long" type="text" name="opis" value="
<? echo $row['opis']; ?>">
</tr><br/>
<tr>
<td class="label">www:</td><td><input class="long" type="text" name="www" value="
<? echo $row['www']; ?>">
</tr><br/>
<tr>
<td class="label">Czdjecie:</td><td><input class="long" type="text" name="zdjecie" value="
<? echo $row['zdjecie']; ?>">
</tr><br/>
<tr>
<td class="label">gmx:</td><td><input class="long" type="text" name="gmx" value="
<? echo $row['gmx']; ?>">
</tr><br/>
<tr>
<td class="label">gmy:</td><td><input class="long" type="text" name="gmy" value="
<? echo $row['gmy']; ?>">
</tr><br/>
<tr>
<td class="label">counter:</td><td><input class="long" type="text" name="counter" value="
<? echo $row['counter']; ?>">
</tr><br/>
<tr><td><td align="center"><input type="submit" name="changes" value="ok">
</form>
</table>
<?
}
endif;