| | |
taking the value from the URL....
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: May 2007
Posts: 66
Reputation:
Solved Threads: 0
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++;
}
?>
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.
•
•
Join Date: Aug 2007
Posts: 189
Reputation:
Solved Threads: 14
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)
WHERE id = '". $_GET['id'] . "'
![]() |
Similar Threads
- Buy Targeted Traffic, higher ROI (Ad Space for Sale)
- Virus Alert! icon in the Notification Bar <<HELP>> (Viruses, Spyware and other Nasties)
- If you were the father? (Geeks' Lounge)
- Instal of wxPython (Python)
- My computer is really slow and has been taking forever to get anywhere on the interne (Viruses, Spyware and other Nasties)
- VB6 and MS Access 2002 (Visual Basic 4 / 5 / 6)
- URL's (Links) in MSN.com "Hotmail" do not work. (Web Browsers)
- about:blank when trying to go to yahoo.com (Viruses, Spyware and other Nasties)
- Adding controls into a ListView (Visual Basic 4 / 5 / 6)
Other Threads in the PHP Forum
- Previous Thread: How to insert image in directory using mySQL
- Next Thread: file upload code.....need attention
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access activation ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration interactive ip java javascript joomla limit link login loop mail menu mlm mobile mod_rewrite msqli_multi_query multiple mysql navigation oop paging parse paypal pdf php problem procedure query radio ram random recursion regex remote script search server sessions smash sms soap source space sql structure syntax system table tutorial update upload url validation validator variable video web websitecontactform xml youtube





