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? 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. 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. 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(); 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? 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. 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. 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 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. 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 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) 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 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 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 Link to comment https://forums.phpfreaks.com/topic/133103-cant-update/#findComment-694531 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.