Author Topic: problem php&MySQL UPDATE  (Read 214 times)

0 Members and 1 Guest are viewing this topic.

Offline arbitterTopic starter

  • Enthusiast
  • Posts: 342
  • Gender: Male
    • View Profile
problem php&MySQL UPDATE
« on: February 10, 2010, 01:10:56 PM »
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) < or strlen($oud) >20){echo $melding;}
	
	
elseif(
strlen($nieuw) < or strlen($nieuw) >20){echo $melding;}
	
	
elseif(
strlen($nieuw2) < or strlen($nieuw2) >20){echo $melding;}
	
	
else{
	

	

	
	
	
require_once(
'mysql_connect.inc.php');
	
	
	
mysql_connect(MYSQL_SERVERMYSQL_GEBRUIKERSNAAMMYSQL_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.

Offline sader

  • Enthusiast
  • Posts: 268
    • View Profile
Re: problem php&MySQL UPDATE
« Reply #1 on: February 10, 2010, 01:30:05 PM »
maybe u forget put session_start() at the begining of the script?
« Last Edit: February 10, 2010, 01:30:41 PM by sader »

Offline arbitterTopic starter

  • Enthusiast
  • Posts: 342
  • Gender: Male
    • View Profile
Re: problem php&MySQL UPDATE
« Reply #2 on: February 10, 2010, 01:35:41 PM »
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.