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
https://forums.phpfreaks.com/topic/41597-update-blues/
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
https://forums.phpfreaks.com/topic/41597-update-blues/#findComment-201590
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
https://forums.phpfreaks.com/topic/41597-update-blues/#findComment-201611
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.