DB data not showing up

Try this to debug. The idea is to see where id is coming from, what it’s initial value is and why it’s failing:


if ( isset($_GET['id']) ) { 
     echo "id from GET: " . $_GET['id'] . "<br>"; //debug
     $id = (int) $_GET['id']; 

} else if (isset($_SESSION['id'])) { 
     echo "id from SESSION: " . $_SESSION['id'] . "<br>"; //debug     
     $id = (int) $_SESSION['id']; 

} else { 
     
   include_once "index.php"; 
   exit(); 
} 
$id = str_replace('`', '', $id);
     echo "id after ` filter: $id<br>"; //debug

$id = (int)$id; 
if( $id == 0 ) { 
  exit('Invalid member'); 
} 

Now you should see the where id comes from and where it becomes invalid. My guess is that it had a ` and one of the earlier calls to (int) made it zero because of that character.

If your id has ` you need to remove it before trying to cast it to be int.

ok, this is error it just gave me

id from SESSION:
id after ` filter: 0
Invalid member

but I can’t find the ` I guess could it be in the checkuserlog.php the script to check if they are logged in?

besides the str_replace line I can’t find it

id from SESSION: //shouldn’t this line have printed something?
id after ` filter: 0
Invalid member

Yep, if there was no value in the id from SESSION line that means that $_SESSION[‘id’] existed, or it was an empty string (or null or false).

So the id is not being stored in your session properly.

ok, so that’s what I thought originally, I’m stumped

it has a NOT NULL in the DB, I have no idea what to do next

ok, so the id field in the db does exist, not null, integer with auto increment, and during the registration process the info is getting written to the db, so what do I do next?

the login script now has the session start at the beginning of it.

as I asked earlier, when I hit the view profile button in the flash header, it just goes to profile.php without the ?id=# after it, would this be a problem with the flash header communicating with the login script? Because it appears to log me in, the flash header has different states, if u are not logged in it will show email and password fields, if u are logged in it shows view profile, edit profile and log our buttons, so after I login, it does show me the 3 buttons, so it is recognizing that I am logged in.

well I finally got it to work, ran an exit script line per line until the id printed no value, turned out that the $id = " " was closing the session, all I did was comment it out and everything works fine, now I have to go and find where it was being called from first.