Jump to content

ChompGator

Members
  • Posts

    171
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ChompGator's Achievements

Member

Member (2/5)

0

Reputation

  1. Hey Everyone, Im having trouble with my sessions again - at least thats what I think - I have: <?php session_start(); ?> at the top of my page... Then Im using <?php echo $_SESSION['first_name'];?> to show the user's first name on the page and it works good. Now Im trying to use, <?php echo $_SESSION['location'];?> To show the users location (which is stored in the db) but its not retrieving their location. And Im wondering if anyone might know why? Im retrieving the users first_name and displaying it on the page and it works ok, how come it wont retrieve their location? If anyone knows why this is, any help would be great. What I did to try and fix this problem is approach it a different way and just used this script where I want their location: <?php $con = mysql_connect("***","***","***") or die('Could not connect: ' . mysql_error()); mysql_select_db("login", $con); $result = mysql_query("SELECT * FROM users"); while($row = mysql_fetch_array($result)){ echo "{$row['location']}"; } ?> But the problem with using that script is it isn't just listing the location for that user, its listing all the locations from the 'location' column in the database. So I edited it to this, and that didnt work to well either: <?php $con = mysql_connect("***","***","***") or die('Could not connect: ' . mysql_error()); mysql_select_db("login", $con); $result = mysql_query("SELECT * FROM users"); WHERE id = '$location'; echo "{$row['location']}"; } ?> Any help anyone could offer would be great - thanks!
  2. Ill give it a shot now...But it couldn't be a problem in my connection string could it? I mean the script is connecting, its just displaying all the ranks in the rank column, instead of the rank for the specific user.
  3. Thanks for all the advice, I was using <? session_start() ?> to start sessions at the top of my page then to display the name, and last name, etc...later in the page I was using <?php echo $_SESSION['name']." <?php echo $_SESSION['last_name']." And that was all working, then I tried using <?php echo $_SESSION['rank']." and for some reason its not showing the rank It will show everything else, the firstname, lastname, date of birth using <?php echo $_SESSION['what-ever-i-specifiy']." but when trying it with the rank, it wont show so then I tried using <?php $con = mysql_connect("****","***","****") or die('Could not connect: ' . mysql_error()); mysql_select_db("login", $con); $result = mysql_query("SELECT * FROM users"); while($row = mysql_fetch_array($result)){ echo "{$row['rank']}"; } ?> Then thats when it starting listing every rank of every user in the table and its still not working
  4. let me try that out, I took your script, Ill post my error here if any give me a few.
  5. Sorry should be more specific, its When a user clicks on their profile to see their rank > instead of just showing their rank its listing all the ranks for all 300 users in the database. And I just want it so that it lists the rank for that specific user.
  6. I have a script (its below) and I have it to where it's retrieving a 'rank' from the database that cooresponds to each user. User 1 = XRank User 2 = YRank User 3 = SRank But when a user logs in and clicks on his profile instead of showing just their rank, its listing all the ranks from the 'rank' column in the database table. I just want it to show that user's rank, does anyone know why that is? <?php $con = mysql_connect("***","***","****") or die('Could not connect: ' . mysql_error()); mysql_select_db("login", $con); $result = mysql_query("SELECT * FROM users"); while($row = mysql_fetch_assoc($result)){ echo "{$row['rank']}"; } ?>
  7. Are you having trouble understanding... I have a <? php session_start(); ?> At the top of my page... Next, I have <?php echo $_SESSION['first_name']." ".$_SESSION['last_name'];?> To show the user's name and last name Then I have a <?php echo $_SESSION['award']; ?> To show the award name the employee has gotten. The question was - Why is it not working is there some sort of error in my code...But there wasnt. I hope that helps you understand what Im asking in a very straight forward manner. Help Forums are for users to help one another...Code posted does not ALWAYS necessarily have to work, go read through some of the other topics you'll see not everyone's code works, hence why they're asking for help. So when you tell me to post code that 'actually works' I respectfully disagree with what you said - not everyones code has to work. Anyway > I have fixed the problem, and believe it or not > it was a MySQL problem, something I had messed up in PHPMyAdmin. Thanks
  8. The column named award is in my database, and it has text in the column, and Im just trying to display the text and its not working, Im going to try something else though - I think I may know the problem - Will post - here if it doesn't work
  9. Well I haven't had to use any sql="SELECT * FROM $tbl_name"; $result=mysql_query($sql); $rows=mysql_fetch_array($result); So far Im just using the echo $_session and its working for me showing the first name and last names, I just went a few more lines down the page, and now Im trying to displaying something different and its not working
  10. Yep, actually I just wanted to make it simple for people to understand... At the top of my page I have a <? session_start(); ?> Then later down the page, I want to display the data from the database - so Im using this <?php echo $_SESSION['award']." Its not called 'new' I shouldn't of put that on there, just was trying to simplify it ha, but yeah that is what Im doing - What I just described
  11. I want to display data on my webpage that is in one of my columns in my database. Im using this script to do it, and the data is not showing up - Can anyone help? <? $host="localhost"; // Host name $username="test"; // Mysql username $password="****"; // Mysql password $db_name="****"; // Database name $tbl_name="****"; // Table name echo $_SESSION['new']; ?>
  12. Hello, Im working on a project, and I need some help/recommendations on how to do this: The final project will allow an Administrator > To Select an Award from an list of awards for Employees > And then in the Employee's Profile - The Award will be displayed for the employee to see. Is there a way to store images in some type database and call the image when needed. Or would the easiest way be put the images in a folder on a server - and call them when necessary....
×
×
  • 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.