944,147 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 1055
  • PHP RSS
Aug 30th, 2007
0

taking the value from the URL....

Expand Post »
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/let...-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++;
}
?>
Last edited by dudegio; Aug 30th, 2007 at 11:26 pm.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
dudegio is offline Offline
66 posts
since May 2007
Aug 31st, 2007
0

Re: taking the value from the URL....

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:

PHP Syntax (Toggle Plain Text)
  1. WHERE id = '". $_GET['id'] . "'
Reputation Points: 52
Solved Threads: 23
Posting Whiz in Training
martin5211 is offline Offline
271 posts
since Aug 2007
Aug 31st, 2007
0

Re: taking the value from the URL....

use $_GET or $_REQUEST
Reputation Points: 28
Solved Threads: 71
Posting Pro
ryan_vietnow is offline Offline
578 posts
since Aug 2007
Aug 31st, 2007
0

Re: taking the value from the URL....

Thanks a lot. Its working.
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
dudegio is offline Offline
66 posts
since May 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: "Validating select box text"
Next Thread in PHP Forum Timeline: file upload code.....need attention





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC