Ell20 Posted January 15, 2008 Author Share Posted January 15, 2008 mysql_connect.php is just in public_hmtl. newcss.php is in /includes Thanks for your help. Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted January 15, 2008 Share Posted January 15, 2008 require_once ('../mysql_connect.php'); Try that. The problem is that the directory doesn't have the file there so it can't call it. Try that. I'm not sure if it'll work. A bit tired to actually check Quote Link to comment Share on other sites More sharing options...
Ell20 Posted January 15, 2008 Author Share Posted January 15, 2008 Excellent, that fixed that and I now have the following on the page source of css color: '#ffffff'; background-color: '#00CCCC'; Which is the correct values taken from the databse BUT the page is still displaying white and not those actual colours!! Thanks Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted January 15, 2008 Share Posted January 15, 2008 It doesn't even say body{}? It just says those 2 lines? Quote Link to comment Share on other sites More sharing options...
Ell20 Posted January 15, 2008 Author Share Posted January 15, 2008 Fixed that! I was stupid and put 'color'! Its changed now Last problem is that when I changed my query back to '$id' it stopped working again and when I viewed the source of CSS the values for colour and text were blank! Yeah it did say body, sorry forgot to copy and paste that bit!! Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted January 15, 2008 Share Posted January 15, 2008 That has to do with sessions. Can you post the part of your code where you created the session 'club_id' Quote Link to comment Share on other sites More sharing options...
Ell20 Posted January 15, 2008 Author Share Posted January 15, 2008 It works on every other page just not on this one: index.php <?php $_SESSION['user_id']=$row[0]; $_SESSION['club_id']=$row[1]; ?> Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted January 15, 2008 Share Posted January 15, 2008 Hmm, okay, I guess we can do one debugging. Under this line: $id = $_SESSION['club_id']; Put this: echo $id."<br />"; Tell me if it echos out the correct ID. Quote Link to comment Share on other sites More sharing options...
Ell20 Posted January 15, 2008 Author Share Posted January 15, 2008 I changed it to this: echo "this".$id." "; All it says is "this" no number after it. Thanks so much for your help. Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted January 15, 2008 Share Posted January 15, 2008 That means $_SESSION['club_id'] is blank. That's what I meant before Quote Link to comment Share on other sites More sharing options...
Ell20 Posted January 15, 2008 Author Share Posted January 15, 2008 Yeah, is there anyway to set as usual? As without it I cant really use the CSS like this? Thanks Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted January 15, 2008 Share Posted January 15, 2008 Well, how are the sessions created? Are the sessions created as someone logs in or what? I don't know what the system does so I'm guessing there is a log in thing. Quote Link to comment Share on other sites More sharing options...
Ell20 Posted January 15, 2008 Author Share Posted January 15, 2008 Yeah thats right the sessions are created when someone logs in, I showed the code a few messages back? Thanks Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted January 15, 2008 Share Posted January 15, 2008 Can you post more of that code? That's kind of vague. Also, did you put session_start() at the top of the index.php file? Quote Link to comment Share on other sites More sharing options...
Ell20 Posted January 16, 2008 Author Share Posted January 16, 2008 index.php <?php if ($u && $p) { $query = "SELECT user_id, club_id, validate FROM users WHERE username='$u' AND password=PASSWORD('$p')"; $result = @mysql_query($query); $row = mysql_fetch_array ($result, MYSQL_NUM); /* If they match create session */ if ($row) { $validate=$row[2]; if ($validate == 1) { /* Redirect to main.php when logged in */ $_SESSION['user_id']=$row[0]; $_SESSION['club_id']=$row[1]; header ("Location: http://" .$_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "main.php"); exit(); ?> session_start() is written inside header.html which is called in every page. Thanks Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted January 16, 2008 Share Posted January 16, 2008 But you still need session_start() on that page. Try putting it in at the top but under <?php of course. If that doesn't work, I'll check up on this later. Dinnertime for me, so I'll check back later. Maybe someone else can fill in for me while I'm satisfying my tummy. Quote Link to comment Share on other sites More sharing options...
Ell20 Posted January 16, 2008 Author Share Posted January 16, 2008 Superb!! Thank you so much!! Appreciate your help ;D Working perfectly now Enjoy your dinner Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.