Jump to content


Photo

session output - get outa here!


  • Please log in to reply
1 reply to this topic

#1 timetomove

timetomove
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 18 October 2006 - 09:13 PM

Any help appreciated.

I'm working within the framework of a object orientated login script using sessions.

Basically, once a user is logged in I would like to list all of the books_titles and book_authors(for example) that are held in the database table: readinglist for that logged in user of the website

please bear with me...

to do this is have called the function, getReadinglistInfo($username) which does the select query for that user.

the session cookie is recognised by setting variables in a seperate file(session.php) like:

var $readinglist = array();
var $booktitle;
var $bookauthor;


in the
checkLoginfunction()
i added:
$this->readinginfo = $database->getReadinglistInfo($username);
$this->booktitle = $this->readinginfo['book_title'];
$this->bookauthor = $this->readinginfo['book_author'];

.........

and then on the actual web page i used:

$req_user = trim($_GET['user']);

/* Display requested garden information */
$req_reading_info = $database->getReadinglistInfo($req_user);

echo "Book Title: ".$req_reading_info['book_title']."
";

echo "Book Author: ".$req_reading_info['book_author']."
";


...........

This then gives the FIRST book title and author for that user in my readinglist table.

I havent put all the code here but I hope you get the idea.
I probably havent copied it down here very accurately either but...
It works GREAT on my website.....

EXCEPT, it will only show the first record in the database (for that user).

What I would like to do is loop through all the book titles and authors(for the user)
I dont know if i need an array within an array?Huh

It would be great if someone who understands this could advise on how its best done.

Thanks,

Tim

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 19 October 2006 - 01:09 AM

afther 4 cups of coffe and 3 cigs i get it now.

i think the reason wht your getting only the books that the user has submitted is becouse you ask the database to show all the boooks that the current user has got now to get also all the othere books you need not to use $user varable that way your see all books.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users