meme;11044385 wrote:I added start session at the top of page but didn't work, I did the sql connect but I didn't copy it cause its abit too long, I mean in the first page, second page I dint think I need to, do I? I do care but I don't know how, I am not a professional I am a student and I am still learning, not as fast as I would like but I will get there eventually, and we are using MySQL because the instructor asked us to, not my choice I don't know any other way...
Like I said, before you ever refer to $_SESSION or the values it contains, you first have to call [man]session_start[/man]. This is mandatory or you are just going to end up confusing yourself and having code that does not work. I'd recommend reading the manual page I just linked there if you haven't already. It might not all make sense, but hopefully some of it will start to stick and will make sense later. The basic idea is that you can't start working with PHP's session handling until you tell it to start.
I can certainly appreciate that some code is too long to post. The alternative is that people suggest that you've made a mistake when you actually haven't.
And YES every single page request on your server must reconnect to the MySQL server before you can run any queries. This is why I pointed out that you aren't checking for any errors from your mysql statements. If you were, you would see that an error is generated if you try to run a query without first successfully connecting to the database. If you check for errors when you connect to the database, you might see errors generated if that connection fails.
As for your instructor telling you to use mysql, you might or might not want to tell him/her that [man]mysql[/man] has been deprecated (i.e., retired) in favor of [man]mysqli[/man]. I'd also recommend reading the manual a bit. It's full of examples that actually work. It might take a little extra time to read it, but you'll probably be saving all that much-more-frustrating time where you just sit around wondering why it's not working.