need help using links like test.php3?id=2

Reply

Join Date: Jul 2004
Posts: 3
Reputation: Specdro is an unknown quantity at this point 
Solved Threads: 0
Specdro Specdro is offline Offline
Newbie Poster

need help using links like test.php3?id=2

 
0
  #1
Jul 28th, 2004
I have been tring for a month now to figure out why I can't program my site to open field information from a link that looks like http://www.blablabla.com/test.php3?ID=2
I can't seem to figure out how to open just the field thats ID is = to 2.
If anyone can help I would be greatful. Thank you.

-Specdro
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 113
Reputation: liliafan is on a distinguished road 
Solved Threads: 2
liliafan's Avatar
liliafan liliafan is offline Offline
Junior Poster

Re: need help using links like test.php3?id=2

 
0
  #2
Jul 28th, 2004
Originally Posted by Specdro
I have been tring for a month now to figure out why I can't program my site to open field information from a link that looks like http://www.blablabla.com/test.php3?ID=2
I can't seem to figure out how to open just the field thats ID is = to 2.
If anyone can help I would be greatful. Thank you.
-Specdro
How are you trying to access the data? Do you have a code example?

Ben
Application development, webhosting, and much more: www.webcentric-hosting.com
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 3
Reputation: Specdro is an unknown quantity at this point 
Solved Threads: 0
Specdro Specdro is offline Offline
Newbie Poster

Re: need help using links like test.php3?id=2

 
0
  #3
Jul 28th, 2004
Originally Posted by liliafan
How are you trying to access the data? Do you have a code example?

Ben
this is the code I have to create the link but from there Im lost.

[php]$query = "SELECT * FROM mobsters";
$result = mysql_query($query);
while($row = mysql_fetch_array($result))

{
echo "<li><font face=verdana size=-2><b><a href=http://www.mafia-files.com/test2.php3?ID=$row[ID]><?$row[Name]
</td></tr><tr><td>";



}


?>[/php]
Last edited by cscgal; Jun 10th, 2006 at 11:54 pm.
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 113
Reputation: liliafan is on a distinguished road 
Solved Threads: 2
liliafan's Avatar
liliafan liliafan is offline Offline
Junior Poster

Re: need help using links like test.php3?id=2

 
0
  #4
Jul 28th, 2004
From the look of the code on the next page:

  1. <?php echo $ID; ?>

Should work.

HTH

Ben
Application development, webhosting, and much more: www.webcentric-hosting.com
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 234
Reputation: PoA is an unknown quantity at this point 
Solved Threads: 8
PoA PoA is offline Offline
Posting Whiz in Training

Re: need help using links like test.php3?id=2

 
0
  #5
Jul 30th, 2004
Try this.

[PHP]
<?php
$query = "SELECT * FROM mobsters";
$result = mysql_query($query);
while($row = mysql_fetch_array($result))

{
echo "<li><font face=verdana size=-2><b><a href=http://www.mafia-files.com/test2.php3?ID=$row['ID']>$row['Name']</a>
</td></tr><tr><td>";
}
?>[/PHP]
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 113
Reputation: liliafan is on a distinguished road 
Solved Threads: 2
liliafan's Avatar
liliafan liliafan is offline Offline
Junior Poster

Re: need help using links like test.php3?id=2

 
0
  #6
Jul 30th, 2004
What code are you actually using to fetch the ID on the next page?

Ben
Application development, webhosting, and much more: www.webcentric-hosting.com
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 9
Reputation: kenleycapps is an unknown quantity at this point 
Solved Threads: 0
kenleycapps's Avatar
kenleycapps kenleycapps is offline Offline
Newbie Poster

Re: need help using links like test.php3?id=2

 
0
  #7
Aug 4th, 2004
[PHP]
$id = $_GET['id'];
[/PHP]

That's how you get $id on the following page.
Current languages this technical polyglot knows:
PHP

Languages this technical polyglot is working on:
C++
Java
XML
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 6
Reputation: huwgomez is an unknown quantity at this point 
Solved Threads: 0
huwgomez huwgomez is offline Offline
Newbie Poster

Re: need help using links like test.php3?id=2

 
0
  #8
Aug 5th, 2004
Try this as the query on ur second page. worked for me. (Got this off Roberdin)

$query = "SELECT * FROM mobsters where ID='{$_GET['ID']}'";


Huw.
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 11
Reputation: rice_web is an unknown quantity at this point 
Solved Threads: 1
rice_web rice_web is offline Offline
Newbie Poster

Re: need help using links like test.php3?id=2

 
0
  #9
Aug 9th, 2004
Originally Posted by huwgomez
Try this as the query on ur second page. worked for me. (Got this off Roberdin)

$query = "SELECT * FROM mobsters where ID='{$_GET['ID']}'";


Huw.
Don't forget an if(...) { ... } statement. Setup something like this:

[PHP]
$pageID = $_GET['ID'];

if(is_numeric($pageID) && $pageID > 0) {

$pageID = round($pageID);

$query = "SELECT * FROM mobsters where ID='{$_GET['ID']}'";

}
else {

print("Invalid Page ID");

}
[/PHP]
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 1
Reputation: evilfourzero is an unknown quantity at this point 
Solved Threads: 0
evilfourzero evilfourzero is offline Offline
Newbie Poster

Re: need help using links like test.php3?id=2

 
0
  #10
Jun 9th, 2006
I think he means how to access it..You would do this:

  1. $id = $_REQUEST["id"];
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC