Jump to content

update blues


eciym

Recommended Posts

Hi, I have this update query and it looks fine to me, however it doesn't update. Could somebody please explain why it doesnt update? It prints out all the variables, it's suposed to.

 

Thanks

 

function byttpass($password)   {

	 $db = mysql_connect("localhost","user", "password") or die(mysql_error());

         mysql_select_db("db",$db) or die(mysql_error());

	 echo "+++++ $db +++++";

         $id = mysql_escape_string($id);
         $password = mysql_escape_string(md5($password));

         /*echo "$id";
	 echo "$password";
          $result = mysql_fetch_array(mysql_query("SELECT id, username, password, token, session, ip FROM member WHERE id = '{$id}'"), MYSQL_ASSOC);
	  echo "----- $result ------";*/

          $update = mysql_query("UPDATE member SET password='$password' WHERE id = '{$id}'") or DIE ($this->query_error);
          $result = mysql_query($update);
          $this->message .= '<p>lösenord uppdaterade</p>';
	  $_POST = "updated";
          $this->set_session($result,true); //log user on
          return true;
		}
       

Link to comment
Share on other sites

<?php
$update = mysql_query("UPDATE member SET password='$password' WHERE id = '{$id}'") or DIE ($this->query_error);
?>

 

change this to:

 

<?php
$update = mysql_query("UPDATE member SET password='$password' WHERE id = '$id'") or DIE ($this->query_error);
?>

 

monk.e.boy

Link to comment
Share on other sites

What i tend to do is try and narrow the fault down

 

use mysql_error() and then yuo will get an output driectly from MYSQL and that shoudl help you narrow it down.

 

for example:

 

$update = mysql_query("UPDATE member SET password='$password' WHERE id = '$id'") or DIE ("Mysql Returned: ". mysql_error(). " ". mysql_errno());

 

typicly mysql will return an error message and number that will help u sus out the proplemmo :)

 

Link to comment
Share on other sites

OK I changed the script like you said, however it doesnt give an error message, just runs like it did the update, but doesnt change the database. Another problem i had was an error messsage about headers that somebody here suggested using start_ob() to fix *(there are no spaces on the scripts that usually cause this error). perhaps that has got something to do with it? error message reads

 

Warning: Cannot modify header information - headers already sent by (output started at ptf/member_class.php:132) in ptf/member_class.php on line 92.

 

But perhaps that is a red herring

 

90  function update_cookie($token)  {

91  $cookie = serialize(array($_SESSION['username'],$token));

92  setcookie('remember',$cookie, time()+12099600);

        }

 

131 $ip = mysql_escape_string($_SERVER['REMOTE_ADDR']);

132 print "check session /_$id  /_$token /_$session /_$ip /_ $cookie /_ $username /_";

133 $result = mysql_query("SELECT * FROM member WHERE id='{$id}' AND token='{$token}' AND session='{$session}' AND ip='{$ip}'") or DIE ($this->query_error5);

134if ($result != false){

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.