Results 1 to 2 of 2
  1. #1
    Join Date
    May 2012

    Unhappy Unanswered: mysql "F5" peculiarity

    Hi. I am developing a site with two databases - one is for customers to apply to join as members, the other is a members database. Everything seemed to be working well, until I tried "bug hunting".

    When a new member signs up, they are deleted from the first db and added to the second. If that member then uses the back button, hits F5, or calls the php page directly, problems start occurring.

    I am convinced that the problem lies here :
    			$_SESSION[exists] = "0";
    			mysql_select_db("applydb", $con);
    			$result = mysql_query("SELECT email FROM apply
    				WHERE email = '$_SESSION[email]' LIMIT 1");
    			while($row = mysql_fetch_array($result))
    				$_SESSION[exists] = "1";
    this code checks weather the person has applied or not. If they are found (exists=1) they are added to the new db and deleted from this one.

    This is working perfectly in regular use. however, even after they have been deleted, recalling the page makes $_SESSION[exists] = "1" even when they dont, resulting in duplicate entries to the members database.

    I have checked the applydb and it is empty.

    adding this:
    echo "registered exists is ".$_SESSION[exists];
    to both the top and the bottom of the script, returns 0 then 1, saying it found the non-existent member :/

    Again, just to iterate, this works perfectly with normal use. It is only when recalled that the error occurs.

    This is what I used to delete the member:
    				mysql_select_db("applydb", $con);
    				mysql_query("DELETE FROM apply WHERE email = '$_SESSION[email]' LIMIT 1");
    				if (!$con)
    				{  die('Error: ' . mysql_error());}
    I can include more script if wanted, but cannot see that it is relevant; the database is empty.

    Is this perhaps just a peculiarity?

    Hope this makes sense, and that you can help.

  2. #2
    Join Date
    Apr 2002
    Toronto, Canada

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts