Jump to content
php.lv forumi

Problemas ar UPDATE


marnix

Recommended Posts

Sveiki.

Man skripts stavot uz kompja labojot profilu vinš updeito datubāzi bet ieliekot hostingā errorus nemet bet neupdeito ierakstus. Kas varētu būt par lietu. Nomainot mainigas vertibas pie update uz parastu tekstu viņš apdeito bet ar mainigam nē.

<? @session_start(); ?>
<?
if (empty($_COOKIE["lang"])){
include 'lang/lv.php';
}
elseif ($_COOKIE['lang'] == 'lv'){
include 'lang/lv.php';
}
elseif ($_COOKIE['lang'] == 'eng'){
include 'lang/eng.php';
}
?>
<?
if(!session_is_registered(lietotajvards)){
printf("error");
}
else{
printf("<html>");
printf("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />");
printf("<head>");
printf("<title>$edit_head</title>");
printf("<link rel='stylesheet' type='text/css' href='style.css'>");
printf("</head>");
printf("<body>");
include 'config.php';
@mysql_connect("$dbhost", "$dbuser", "$dbpass");
@mysql_select_db("$dbname");
if(isset($_POST['submit'])){
$lietotajvards = "$_POST[lietotajvards]";
$parole = "$_POST[parole]";
$parole1 = "$_POST[parole1]";
$vards = "$_POST[vards]";
$uzvards = "$_POST[uzvards]";
$emails = "$_POST[emails]";
$kanals1 = "$_POST[kanals1]";
$kanals2 = "$_POST[kanals2]";
$kanals3 = "$_POST[kanals3]";
$valsts = "$_POST[valsts]";
$klubs = "$_POST[klubs]";
$vardss = "kaka";
$res = @mysql_query("select * from lietotaji where lietotajvards = '$lietotajvards'");
while ($row = @mysql_fetch_array($res)){{;
if(isset($row)){
}
else{
}
$liet = $row[1];
}
}
if(empty($parole)){
$error = "$reg_err2";
}
elseif(empty($parole1)){
$error = "$reg_err3";
}
elseif($parole  != $parole1){
$error = "$reg_err4";
}
elseif(empty($vards)){
$error = "$reg_err5";
}
elseif(empty($uzvards)){
$error = "$reg_err6";
}
elseif(empty($emails)){
$error = "$reg_err7";
}
elseif(empty($kanals1)){
$error = "$reg_err8";
}
else{
$error = "$edit_err";
$datums = date("d.m.Y, H:i");
mysql_query('UPDATE lietotaji SET parole = "$_POST[parole]", vards = "$_POST[vards]", uzvards = "$_POST[uzvards]", emails = "$_POST[emails]", kanals1 = "$_POST[kanals1]", kanals2 = "$_POST[kanals2]", kanals3 = "$_POST[kanals3]", valsts = "$_POST[valsts]", klubs = "$_POST[klubs]" WHERE lietotajvards = "$_POST[lietotajvards]"');
}
printf("<form action=\"edit.php\" method=\"post\">\n");
printf("<h3><div align=\"center\">$edit_title</div></h3><table>\n");
printf("<div align=\"center\"><span style='color:red'>$error</span></div>\n");
printf("<tr><td>$reg_passw<span style='color:red'> *</span></td><td><input type=\"password\" maxlenght=\"22\" name=\"parole\"></td></tr>\n");
printf("<tr><td>$reg_passw2<span style='color:red'> *</span></td><td><input type=\"password\" maxlenght=\"22\" name=\"parole1\"></td></tr>\n");
printf("<tr><td>$reg_name<span style='color:red'> *</span></td><td><input type=\"text\" maxlenght=\"22\" value=\"$_POST[vards]\" name=\"vards\"></td></tr>\n");
printf("<tr><td>$reg_uzv<span style='color:red'> *</span></td><td><input type=\"text\" maxlenght=\"22\" value=\"$_POST[uzvards]\" name=\"uzvards\"></td></tr>\n");
printf("<tr><td>$reg_mail<span style='color:red'> *</span></td><td><input type=\"text\" maxlenght=\"30\" value=\"$_POST[emails]\" name=\"emails\"></td></tr>\n");
printf("<tr><td>$reg_chan<span style='color:red'> *</span></td><td>1#<input type=\"text\" size=\"3\" maxlenght=\"3\" value=\"$_POST[kanals1]\" name=\"kanals1\"><br>2#<input type=\"text\" size=\"3\" maxlenght=\"3\" value=\"$_POST[kanals2]\" name=\"kanals2\"><br>3#<input type=\"text\" size=\"3\" maxlenght=\"3\" value=\"$_POST[kanals3]\" name=\"kanals3\"></td></tr>\n");
printf("<tr><td>$reg_valst</td><td><input type=\"text\" maxlenght=\"22\" value=\"$_POST[valsts]\" name=\"valsts\"></td></tr>\n");
printf("<tr><td>$reg_club</td><td><input type=\"text\" maxlenght=\"30\" value=\"$_POST[klubs]\" name=\"klubs\"></td></tr>\n");
printf("<input type=\"hidden\" name=\"lietotajvards\" value=\"$lietotajvards\">\n");
printf("<tr><td><td>$reg_not</td></tr>\n");
printf("<tr><td></td><td><input type=\"submit\" name=\"submit\" value=\"OK\"></td></td></tr>\n");
printf("</form>");
printf("</table>");
}
else{
$lietv = $_SESSION['lietotajvards'];
$res = @mysql_query("select * from lietotaji where lietotajvards = '$lietv'");
while ($row = @mysql_fetch_array($res)){{;
if(isset($row)){
}
elseif(empty($parbaude));
}
$lietotajvards1 = $row[1];
$parole1 = $row[2];
$vards1 = $row[3];
$uzvards1 = $row[4];
$emails1 = $row[5];
$kanals1 = $row[6];
$kanals2 = $row[7];
$kanals3 = $row[8];
$valsts1 = $row[9];
$klubs1 = $row[10];
}
print("<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>\n");
print("<form action=\"edit.php\" method=\"post\">\n");
print("<h3><div align=\"center\">$edit</div></h3><table>\n");
print("<tr><td><b>$reg_usrn</b> $lietotajvards1<br></td></tr>\n");
print("<tr><td><b>$reg_name</b> $vards1</td></tr>\n");
print("<tr><td><b>$reg_uzv</b> $uzvards1</td></tr>\n");
print("<tr><td><b>$reg_mail</b> $emails1</td></tr>\n");
print("<tr><td><b>$reg_chan</b><br><b>1#</b> $kanals1<br><b>2#</b> $kanals2<br><b>3#</b> $kanals3</td></tr>\n");
print("<tr><td><b>$reg_valst</b> $valsts1</td></tr>\n");
print("<tr><td><b>$reg_club</b> $klubs1</td></tr>\n");
print("<input type=\"hidden\" name=\"lietotajvards\" value=\"$lietotajvards\">\n");
print("<input type=\"hidden\" name=\parole\" value=\"$parole1\">\n");
print("<input type=\"hidden\" name=\"vards\" value=\"$vards1\">\n");
print("<input type=\"hidden\" name=\"uzvards\" value=\"$uzvards1\">\n");
print("<input type=\"hidden\" name=\"emails\" value=\"$emails1\">\n");
print("<input type=\"hidden\" name=\"kanals1\" value=\"$kanals1\">\n");
print("<input type=\"hidden\" name=\"kanals2\" value=\"$kanals2\">\n");
print("<input type=\"hidden\" name=\"kanals3\" value=\"$kanals3\">\n");
print("<input type=\"hidden\" name=\"valsts\" value=\"$valsts1\">\n");
print("<input type=\"hidden\" name=\"klubs\" value=\"$klubs1\">\n");
print("<tr><td></td><td><input type=\"submit\" name=\"submit\" value=\"$edit_but\"></td></td></tr>\n");
print("</form>");
print("</table>");
}
}
?>
</body>
</html>

Link to comment
Share on other sites

1) paste.php.lv,

2) indentācija!!!,

3) Tev vispār tur nevarēja strādāt tas updeits pareizi. Tu esi salidzis mainīgos iekš stringa, kas netiek pārsēts (Strings vienpēdiņās).

4) $error = "$edit_err"; ? Kāda jēga no pēdiņām ?

5) Kāpēc katru prastāko html rindu drukā no php ? Labāk nebūtu, ja vienkārši aizvērtu php tagu, izdrukātu html, un tad atkal atvērtu ?

Link to comment
Share on other sites

uztaisi pēc kverija echo mysql_error();

 

kā arī echo "UPDATE lietotaji SET parole = '$_POST[parole]', vards = '$_POST[vardss]', uzvards = '$_POST[uzvards]', emails = '$_POST[emails]', kanals1 = '$_POST[kanals1]', kanals2 = '$_POST[kanals2]', kanals3 = '$_POST[kanals3]', valsts = '$_POST[valsts]', klubs = '$_POST[klubs]' WHERE lietotajvards = '$_POST[lietotajvards]'";

 

Un apskaties vai kverijs tiešām izskatās tāds, kādu tu viņu gribi.

Link to comment
Share on other sites

×
×
  • Create New...