0

I have printed questions on faq.php...
when click on that question it will go to faqview.php
In that faqview.php , i want to print my previous viewd question...

Can any one help me out...
Help is urgent...
Thanks..

3
Contributors
12
Replies
13
Views
8 Years
Discussion Span
Last Post by Shanti C
Featured Replies
  • 1

    I guess you could also do that in the database too. Have like an faq_activity table that updates every time a user views an faq and then you could just pull the 4 most recent for that user. You'd have to keep it cleaned up else it will get fairly … Read More

0

Hey i tried this :

if(!empty($_GET['nid']))
{
session_unregister();
session_register();
$_SESSION['prev'].=$_GET['nid'];
$_SESSION['prev'].=",";
print_r($_SESSION['prev']);
}

I got the answer correctly..
But any other thougts with out sessions...will be appreciated..

0

faq.php

<a href="faqview.php?faqpk=12">FAQ Title</a>

faqview.php

<?
if(!is_numeric($_GET['faqpk']))
{
	header("location: faq.php");
	exit();
}

$faqpk = $_GET['faqpk'];
$query = "select title, description from faq where faqpk = " . $faqpk;
$result = mysql_query($query);

while ($row = mysql_fetch_assoc($result)) {
    echo "<p>".$row["title"]."</p>";
    echo "<p>".$row["description"]."</p>";
}
?>
0

Thanks...
And i want to print four previously viewed questions ...
Than what should i do..

0

sorry for my grammitical mistakes...
I want to print four or more previously viewed questions on my faqview.php

Thanks...

0

Have an array, put the question numbers (or ids) you have viewed in the array. Keep the array in the session. Display last 4 questions using the last 4 indexes of the array.

0

Yes Nav...
I also did like that ,i got..
But i want it with out sessions...
If any thought ,Please Tel me...
Thank you...

0

Well, then you have to pass the array as a hidden form element. But if the user uses back button, then the chances of these values getting 'lost' is more.

1

I guess you could also do that in the database too. Have like an faq_activity table that updates every time a user views an faq and then you could just pull the 4 most recent for that user. You'd have to keep it cleaned up else it will get fairly large, but it could be as simple as a faq_activitypk, faqpk and userpk.

$query = "select distinct faqpk, userpk from faq_activity where userpk = " . $userpk . " order by faq_activitypk desc limit 4";

something like that.

Comments
smart reply...
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.