marnix Posted February 23, 2007 Report Share Posted February 23, 2007 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 More sharing options...
andrisp Posted February 23, 2007 Report Share Posted February 23, 2007 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 More sharing options...
marnix Posted February 23, 2007 Author Report Share Posted February 23, 2007 paskaidro par to indentāciju ko man vajag mainit? Link to comment Share on other sites More sharing options...
andrisp Posted February 23, 2007 Report Share Posted February 23, 2007 Piemērs (tavs kods): http://paste.php.lv/5193 Izmantoju http://www.bierkandt.org/beautify/ šoreiz. Link to comment Share on other sites More sharing options...
marnix Posted February 23, 2007 Author Report Share Posted February 23, 2007 nu izmainiju pediņas tagad kods ir šāds http://paste.php.lv/5194 bet nestrādā uz hosta tikuntā :( bet kompī gan strādā.. Kas par vainu? Kautkas ar mainigajiem?? vai kas? Link to comment Share on other sites More sharing options...
andrisp Posted February 23, 2007 Report Share Posted February 23, 2007 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 More sharing options...
marnix Posted February 23, 2007 Author Report Share Posted February 23, 2007 mysql_error kļudas neizvada - viss ok un ar echo update izvada pareizi mainigo vertibu vieta nepieciešamo infu. tikai vienigi atkal neierakstās :( Link to comment Share on other sites More sharing options...
marnix Posted February 23, 2007 Author Report Share Posted February 23, 2007 ludzu kads pasakat ko man derētu izmainīt lai ierakstītos Link to comment Share on other sites More sharing options...
xcwcx Posted February 23, 2007 Report Share Posted February 23, 2007 pievieno mysql_error šādi: mysql_query("blabla") or die(mysql_error()); Link to comment Share on other sites More sharing options...
marnix Posted February 24, 2007 Author Report Share Posted February 24, 2007 Pievienienoju to mysql_error Bet joks tāds kad neparādās nekāds errors. Kas par desām??? A nevar izmantot INSERT funkciju un noradit WHERE lietotajvards = '$_POST[lietotajvards]' ???? Link to comment Share on other sites More sharing options...
andrisp Posted February 24, 2007 Report Share Posted February 24, 2007 (edited) Nē. Tam ir UPDATE. Edited February 24, 2007 by andrisp Link to comment Share on other sites More sharing options...
john.brown Posted February 24, 2007 Report Share Posted February 24, 2007 Lieki tukšumi tev tanī WHERE vērtībā neparādās? Tu trim($_POST['lietotajvards']) pamēģini. Vai charsets neatbilst. Tad vienkārši neatrod atbilstošu ierakstu, un erroru nekādu nebūs :) Link to comment Share on other sites More sharing options...
marnix Posted February 25, 2007 Author Report Share Posted February 25, 2007 (edited) Nav nekadi tukšumi. Trimu pameģināju bet nekas nemainās. :( Esmu izmisumā.. kas par vainu??? Edited February 25, 2007 by marnix Link to comment Share on other sites More sharing options...
andrisp Posted February 25, 2007 Report Share Posted February 25, 2007 Pārliecinājies vispār vai tabulā `lietotāji` ir attiecīgais ieraksts, ko gribi updeitot ? Link to comment Share on other sites More sharing options...
marnix Posted February 25, 2007 Author Report Share Posted February 25, 2007 protams kad ir ieraksts... Link to comment Share on other sites More sharing options...
Recommended Posts