karq Posted November 17, 2008 Share Posted November 17, 2008 <?php //votame formi data $pealkiri=$_POST["peal"]; $uudis=$_POST["uudis"]; $num=$_POST["id"]; //Tuli ikka õigest kohast if (!isset($pealkiri) || !isset($uudis)) { echo "<center><b>Kuskil oli viga, proovi uuesti</b><br />"; echo "<a href='muuda.php'>Tagasi</a><center>"; }//kui tuldi valest kohast //Kui väljad on tyhjad; elseif (strlen($pealkiri || $uudis)==0){ echo "<center><b>Täida väljad</b><br />"; echo "<a href='muuda.php'>Tagasi</a><center>"; } //Kontrollime kas session on olemas else { session_start(); if (session_is_registered("kasutaja")) { include "db.php"; //uuendame databaasi $uue="UPDATE uudis SET pealkiri='$pealkiri' and uudis='$uudis' WHERE num='$num'"; if (mysql_query($uue,$con)) { echo "<center><b>Databaas uuendatud</b><br /> <a href='muuda.php'>Tagasi</a></center>"; } else { echo mysql_error(); }//kui ei saanud uudendada }//kui kõik oli ok else { echo "<center><b>Te pole sisse loginud</b><br />"; echo "<a href='logi.php'>Logi sisse</a><center>"; } } ?> Why dosent it update that table? Quote Link to comment https://forums.phpfreaks.com/topic/133103-cant-update/ Share on other sites More sharing options...
fenway Posted November 17, 2008 Share Posted November 17, 2008 I assume you're not getting mysql errors... so please echo each one of those update queries. Quote Link to comment https://forums.phpfreaks.com/topic/133103-cant-update/#findComment-692254 Share on other sites More sharing options...
revraz Posted November 17, 2008 Share Posted November 17, 2008 Or use mysql_error after your querries to see if you are getting an error. Quote Link to comment https://forums.phpfreaks.com/topic/133103-cant-update/#findComment-692259 Share on other sites More sharing options...
karq Posted November 17, 2008 Author Share Posted November 17, 2008 the problem is some where here //Kontrollime kas session on olemas else { session_start(); if (session_is_registered("kasutaja")) { include "db.php"; //uuendame databaasi $uue="UPDATE uudis SET pealkiri='$pealkiri' and uudis='$uudis' WHERE num='$num'"; if (mysql_query($uue,$con)) { echo "<center><b>Databaas uuendatud</b><br /> <a href='muuda.php'>Tagasi</a></center>"; } else { echo mysql_error(); Quote Link to comment https://forums.phpfreaks.com/topic/133103-cant-update/#findComment-692262 Share on other sites More sharing options...
fenway Posted November 18, 2008 Share Posted November 18, 2008 That's not really good enough... echo $uue... what is the mysql_error(), if any? Quote Link to comment https://forums.phpfreaks.com/topic/133103-cant-update/#findComment-692716 Share on other sites More sharing options...
karq Posted November 18, 2008 Author Share Posted November 18, 2008 It dosent give any error. It just dosent work. Quote Link to comment https://forums.phpfreaks.com/topic/133103-cant-update/#findComment-692841 Share on other sites More sharing options...
fenway Posted November 18, 2008 Share Posted November 18, 2008 It dosent give any error. It just dosent work. As requested before, please echo the sql query. Quote Link to comment https://forums.phpfreaks.com/topic/133103-cant-update/#findComment-692864 Share on other sites More sharing options...
karq Posted November 19, 2008 Author Share Posted November 19, 2008 It dosent give any error. It just dosent work. As requested before, please echo the sql query. echo mysql_query($update,$con); and the output is 1 Quote Link to comment https://forums.phpfreaks.com/topic/133103-cant-update/#findComment-693711 Share on other sites More sharing options...
fenway Posted November 19, 2008 Share Posted November 19, 2008 It dosent give any error. It just dosent work. As requested before, please echo the sql query. echo mysql_query($update,$con); and the output is 1 Sigh... not the output of the query, the query string itself -- $uue. Quote Link to comment https://forums.phpfreaks.com/topic/133103-cant-update/#findComment-693725 Share on other sites More sharing options...
revraz Posted November 19, 2008 Share Posted November 19, 2008 Another question, why are you running mysql_query on $update when your query is $uue? It dosent give any error. It just dosent work. As requested before, please echo the sql query. echo mysql_query($update,$con); and the output is 1 Quote Link to comment https://forums.phpfreaks.com/topic/133103-cant-update/#findComment-693782 Share on other sites More sharing options...
c0rnf3d Posted November 19, 2008 Share Posted November 19, 2008 $uue="UPDATE uudis SET pealkiri='$pealkiri' and uudis='$uudis' should be a comma there, not AND (but i could be wrong.... im a newb) Quote Link to comment https://forums.phpfreaks.com/topic/133103-cant-update/#findComment-693815 Share on other sites More sharing options...
revraz Posted November 19, 2008 Share Posted November 19, 2008 You're dead on Quote Link to comment https://forums.phpfreaks.com/topic/133103-cant-update/#findComment-693875 Share on other sites More sharing options...
karq Posted November 20, 2008 Author Share Posted November 20, 2008 the comma dosent change anything, still the samething Quote Link to comment https://forums.phpfreaks.com/topic/133103-cant-update/#findComment-694489 Share on other sites More sharing options...
c0rnf3d Posted November 20, 2008 Share Posted November 20, 2008 do a mysql_query($uue,$con) or die(mysql_error()) and see what that returns Quote Link to comment https://forums.phpfreaks.com/topic/133103-cant-update/#findComment-694531 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.