PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hi friends....
I have a table named news which contain columns such as Title, Content,NewsId and many more.
I want to display titles in form of link and when we click any link we get its corresponding Content.
By above code I display Title as link but don't know how to display its corresponding Contents on click.
Plzzzzzzzzzzzzzzzz
Help me anyone...................
Well, right now the link doesn't point anywhere. You probably need to determine what sort of URL string each story will have and fill it in there.
For example, your URL might look like http://www.yoursite.com/story.php?id=123 . Assuming you wrote the code to pull and display the content at story.php, you could then just dynamically generate a link to each story:
i put the tag <a> with the href and i put ?id=row['id'] so in the next page i will call the data "SELECT ..... WHERE id = '".$_REQUEST['id']."'"; and you just execute that query and it will bring the data for the ID and it will know wat data must call
<?
require_once('database.php');
$query="select * from news WHERE NewsId = ".$_GET['id'];
$result = mysql_query($query);
$news_result = mysql_fetch_array($result);
echo $news_result['Content'];
?>
Not tested. This is the logic however. Query in the view page is not really good. But testing you can use this code.