954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

taking the value from the URL....

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 ''."$rec[topic] :".''.truncate($rec["title"],65).'
'."view full transcript".''." [ $rec[date_posted] ]".''."\n";
$count++;
}
?>

dudegio
Junior Poster in Training
66 posts since May 2007
Reputation Points: 10
Solved Threads: 0
 

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'] . "'
martin5211
Posting Whiz in Training
271 posts since Aug 2007
Reputation Points: 52
Solved Threads: 23
 

use $_GET or $_REQUEST

ryan_vietnow
Posting Pro
578 posts since Aug 2007
Reputation Points: 28
Solved Threads: 71
 

Thanks a lot. Its working. :)

dudegio
Junior Poster in Training
66 posts since May 2007
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You