plik w ktorym ma byc mozliwosc edytowania obiektu
<?php
require("./CustomSql.inc.php");
Class CustomSQL extends DBSQL
{
// the constructor
function CustomSQL($DBName = "")
{
$this->DBSQL($DBName);
}
function logincheck($username,$password)
{
$sql = "select `id` from `obiekty` where `iduzyt`='$username'";
$result = $this->select($sql);
return 0;
}else{
$CID = $result[0]["id"];
return $CID;
}
}
function getuserinfobyid($id)
{
$sql = "select * from obiekty where `id` = '$id'";
$result = $this->select($sql);
return $result;
}
function edituser($nazwa,$ul,$kod,$miasto,$tel1,$tel2,$fax,$email,$www,$opis,$cena1,$cena2,$cena3,$cena4,$cena5,$cena6,$opiseng,$opisger,$url1,$CID)
{
$sql = "update obiekty set nazwa='$nazwa',ul='$ul',kod='$kod',miasto='$miasto',tel1='$tel1',tel2='$tel2',fax='$fax',email='$email',www='$www',opis='$opis',cena1='$cena1',cena2='$cena2',cena3='$cena3',cena4='$cena4',cena5='$cena5',cena6='$cena6',opiseng='$opiseng',opisger='$opisger',url1='$url1' where id='$id'";
$results = $this->update($sql);
return $results;
}
}
$db = new CustomSQL($DBName);
$showtable = true;
$errortag = false;
$errortag = true;
$errormsg = $error_emailempty;
}
if ($email!=$emailretype){
$errortag = true;
$errormsg = $error_emailretypewrong;
}
if (!$errortag){
$db->edituser($nazwa,$ul,$kod,$miasto,$tel1,$tel2,$fax,$email,$www,$opis,$cena1,$cena2,$cena3,$cena4,$cena5,$cena6,$opiseng,$opisger,$url1,$url2,$url3,$url4,$url5,$id);
$showtable = false;
}
}
$userinfo = $db->getuserinfobyid($CID);
$nazwa = $userinfo[0]["nazwa"];
$ul = $userinfo[0]["ul"];
$kod = $userinfo[0]["kod"];
$miasto = $userinfo[0]["miasto"];
$tel1 = $userinfo[0]["tel1"];
$tel2 = $userinfo[0]["tel2"];
$fax = $userinfo[0]["fax"];
$email = $userinfo[0]["email"];
$www = $userinfo[0]["www"];
$opis = $userinfo[0]["opis"];
$cena1 = $userinfo[0]["cena1"];
$cena2 = $userinfo[0]["cena2"];
$cena3 = $userinfo[0]["cena3"];
$cena4 = $userinfo[0]["cena4"];
$cena5 = $userinfo[0]["cena5"];
$cena6 = $userinfo[0]["cena6"];
$opiseng = $userinfo[0]["opiseng"];
$opisger = $userinfo[0]["opisger"];
$url1 = $userinfo[0]["url1"];
$url2 = $userinfo[0]["url2"];
$url3 = $userinfo[0]["url3"];
$url4 = $userinfo[0]["url4"];
$url5 = $userinfo[0]["url5"];
?>
<html>
<head>
<title>
<?php print "$front_modiinfo"; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=
<?php print "$front_charset"; ?>">
<link rel="stylesheet" href="./style/style.css" type="text/css">
<script language="JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage;
}}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">
<table width="770" border="0" cellspacing="1" cellpadding="0" align="center" class="table_01">
<tr>
<td class="table_02" width="160" valign="top">
<table width="160" border="0" cellspacing="0" cellpadding="4">
<tr>
<td> </td>
</tr>
<tr>
<td valign="top"></td>
</tr>
</table>
</td>
<td class="menu" bgcolor="#FFFFFF" valign="top" width="610">
<table border="0" cellspacing="0" cellpadding="4" width="610">
<?php
if ($errortag){
?>
<tr>
<td><font color="#FF0000">
<?php print "$errormsg"; ?></font></td>
</tr>
<?php
}
?>
<tr>
<td>
<?php
if ($showtable){
?>
<form action="
<?php print "$PHP_SELF"; ?>" method="POST">
<table border=0 cellpadding=2 cellspacing=2>
<tr><td><b>Dane obiektu noclegowego</b></td></tr>
<tr><td width="150">
<?php print "Nazwa obiektu"; ?> : </td><td><input type="text" name="nazwa" value="
<?php print "$nazwa"; ?>"> <font color="#FF0000">*</font></td></tr>
<tr><td width="150">
<?php print "Ulica"; ?> : </td><td><input type="text" name="ul" value="
<?php print "$ul"; ?>"> <font color="#FF0000">*</font></td></tr>
<tr><td width="150">
<?php print "$front_email"; ?> : </td><td><input type="text" name="email" value="
<?php print "$email"; ?>"> <font color="#FF0000">*</font></td></tr>
<tr><td>
<?php print "$front_emailagain"; ?> : </td><td><input type="text" name="emailretype" value=""> <font color="#FF0000">*</font></td></tr>
<tr><td>
<?php print "Kod pocztowy"; ?> : </td><td><input type="text" name="kod" value="
<?php print "$kod"; ?>"></td></tr>
<tr><td>
<?php print "Miasto"; ?> : </td><td><input type="text" name="miasto" value="
<?php print "$miasto"; ?>"></td></tr>
<tr><td>
<?php print "Telefon"; ?> : </td><td><input type="text" name="tel1" value="
<?php print "$tel1"; ?>"></td></tr>
<tr><td>
<?php print "Telefon"; ?> : </td><td><input type="text" name="tel2" value="
<?php print "$tel2"; ?>"></td></tr>
<tr><td>
<?php print "Fax"; ?> : </td><td><input type="text" name="fax" value="
<?php print "$fax"; ?>"></td></tr>
<tr><td>
<?php print "WWW"; ?> : </td><td><input type="text" name="www" value="
<?php print "$www"; ?>"></td></tr>
<tr><td><b>Ceny noclegów</b></td></tr>
<tr><td>
<?php print "Jednoosobowy"; ?> : </td><td><input type="text" name="cena1" value="
<?php print "$cena1"; ?>"></td></tr>
<tr><td>
<?php print "Dwuosobowy"; ?> : </td><td><input type="text" name="cena2" value="
<?php print "$cena2"; ?>"></td></tr>
<tr><td>
<?php print "Trzyosobowy"; ?> : </td><td><input type="text" name="cena3" value="
<?php print "$cena3"; ?>"></td></tr>
<tr><td>
<?php print "Czteroowobowy"; ?> : </td><td><input type="text" name="cena4" value="
<?php print "$cena4"; ?>"></td></tr>
<tr><td>
<?php print "Apartament"; ?> : </td><td><input type="text" name="cena5" value="
<?php print "$cena5"; ?>"></td></tr>
<tr><td>
<?php print "Dodatkowy cennik"; ?> : </td><td><textarea name="cena6"cols="50" rows="10">
<?php print "$cena6"; ?></textarea></td></tr>
<tr><td><b>Opisy i zdjêcia</b></td></tr>
<tr><td>
<?php print "Opis okolicy"; ?> : </td><td><textarea name="opis"cols="50" rows="10">
<?php print "$opis"; ?></textarea></td></tr>
<tr><td>
<?php print "Opis obiektu po angielsku"; ?> : </td><td><textarea name="opiseng"cols="50" rows="10">
<?php print "$opiseng"; ?></textarea></td></tr>
<tr><td>
<?php print "Opis obiektu po niemiecku"; ?> : </td><td><textarea name="opisger"cols="50" rows="10">
<?php print "$opisger"; ?></textarea></td></tr>
<tr><td>
<?php print "Zdjecie nr. 1"; ?> : </td><td>
<?php if ($wiersz['url1'] != "") echo "<img src='$url1' width=250>"; ?></td></tr>
<tr><td>
<?php print "Zdjecie nr. 2"; ?> : </td><td>
<?php if ($wiersz['url2'] != "") echo "<img src='$url2' width=250>"; ?></td></tr>
<tr><td>
<?php print "Zdjecie nr. 3"; ?> : </td><td>
<?php if ($wiersz['url3'] != "") echo "<img src='$url3' width=250>"; ?></td></tr>
<tr><td>
<?php print "Zdjecie nr. 4"; ?> : </td><td>
<?php if ($wiersz['url4'] != "") echo "<img src='$url4' width=250>"; ?></td></tr>
<tr><td>
<?php print "Zdjecie nr. 5"; ?> : </td><td>
<?php if ($wiersz['url5'] != "") echo "<img src='$url5' width=250>"; ?></td></tr>
<tr><td></td><td><input type="submit" name="edituser" value="
<?php print "$front_modiinfo"; ?>"></td></tr>
</table>
</form>
<?php
}
else{
?>
<a href="index.php">
<?php print "$front_back"; ?></a>
<?php
}
?>
</td>
</tr>
<tr>
<td align="right"> </td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
teraz sie pokazuje formularz do zmiany wpisu ale nie wpisuje danych z bazy :/
co ciekawe ten skrypt dziala ale jak biore username i password z tabeli w ktorej tez jest wpis dokonany, natomiast jesli wezme np z tabeli "user" te dane a wpis tego uzytkownika jest w tabeli "wpis" to juz nie pokazuje danych.
Czy widzicie gdzie blad?