Hello guys!

As usual i need anybody help. pleeeeaaaaase..... :)
My problem is to take value from the URL. Not the entire value but only part of it like the example below.

http://localhost.localdomain/YPS/lets-talk-main-conversation-full.php?id=5

This is the link where the value id is passed from the previous page. Value for id varies on the link being clicked(i.e. taken from the database). No sessions and forms were used. All i need is to take the value 5 from the link so that this will be my reference on my query on that page. Any idea please share. Thanks a lot to everyone. :)

Here's my code on the previous page.

<?php
dbconnect();

$count=0;
$queryresult= mysql_query("SELECT * FROM tbl_topic") or die("SELECT Error: ".mysql_error());
while ($rec=mysql_fetch_array($queryresult, MYSQL_ASSOC)){
$color = ( $count % 2 == 0 ) ? "#eeeeee" : "white";
print '<tr bgcolor="'.$color.'"><td><font>'."$rec[topic] :".'</font >'.truncate($rec["title"],65).'<br/><a style="color:#0066CC; font-size: 10px;" href="lets-talk-main-conversation-full.php?id='.$rec["id"].'">'."view full transcript".'</a>'." [ $rec[date_posted] ]".'</td></tr>'."\n";
$count++;
}
?>

Use WHERE clause to filter occurrences in Mysql results and $_GET or $_POST variables to get url parameters (according to form method). For example, add including the quotes:

WHERE id = '". $_GET['id'] . "'

use $_GET or $_REQUEST

Thanks a lot. Its working. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.