arbitter Posted February 10, 2010 Share Posted February 10, 2010 I have a problem with updating my tables. All works fine, if the fields are empty it sais you need to fill in something, if the first field isn't correct with your real password it does not go any further, and if the 2nd and 3rd field don't match, it sais so. The porblem is, that when the first is corresponding to your reall password and the 2nd and 3rd correspong, the table password doesn't get updated... Any thoughts? if (isset($_POST['actie'])) { $oud = $_POST['oud']; $nieuw = $_POST['nieuw']; $nieuw2 = $_POST['nieuw2']; $oud = strip_tags($oud); $nieuw = strip_tags($nieuw); $nieuw2 = strip_tags($nieuw2); $oud = trim($oud); $nieuw = trim($nieuw); $nieuw2 = trim($nieuw2); $melding = 'Gelieve alle velden in te vullen.'; if(strlen($oud) < 1){echo $melding;} elseif(strlen($nieuw) < 1){echo $melding;} elseif(strlen($nieuw2) < 1){echo $melding;} else{ $melding = 'Uw wachtwoord moet minimum 3 tekens en maximaal 20 tekens lang zijn.'; if(strlen($oud) < 3 or strlen($oud) >20){echo $melding;} elseif(strlen($nieuw) < 3 or strlen($nieuw) >20){echo $melding;} elseif(strlen($nieuw2) < 3 or strlen($nieuw2) >20){echo $melding;} else{ require_once('mysql_connect.inc.php'); mysql_connect(MYSQL_SERVER, MYSQL_GEBRUIKERSNAAM, MYSQL_WACHTWOORD) or die("Verbinding mislukt: " . mysql_error()); mysql_query("SELECT * FROM gebruikers WHERE email='$_SESSION[email]'"); if ($oud != $_SESSION["wachtwoord"]){echo'Paswoord is incorrect. Gelieve deze na te kijken en opnieuw te proberen.'; include('footer.php'); exit();} else { if ($nieuw != $nieuw2){echo 'Nieuwe paswoorden komen niet overeen. Gelieve opnieuw te proberen.';} else{ if ($nieuw == $nieuw2){ echo 'Paswoorden komen overeen!'; mysql_query("UPDATE gebruikers SET wachtwoord='$nieuw' WHERE id='$_SESSION[id]'"); }}}}} (only (i think) the last line is wrong) Yet I have tried to change the apostrophes and stuff. Link to comment https://forums.phpfreaks.com/topic/191651-problem-phpmysql-update/ Share on other sites More sharing options...
sader Posted February 10, 2010 Share Posted February 10, 2010 maybe u forget put session_start() at the begining of the script? Link to comment https://forums.phpfreaks.com/topic/191651-problem-phpmysql-update/#findComment-1010241 Share on other sites More sharing options...
arbitter Posted February 10, 2010 Author Share Posted February 10, 2010 No, checked that, have include('header.php') and header.php starts with <?php[enter]session_start() and otehr functions as login and stuff also work with the inlude header. Link to comment https://forums.phpfreaks.com/topic/191651-problem-phpmysql-update/#findComment-1010247 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.