943,463 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 4753
  • PHP RSS
You are currently viewing page 1 of this multi-page discussion thread
Jul 28th, 2004
0

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

Expand Post »
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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Specdro is offline Offline
3 posts
since Jul 2004
Jul 28th, 2004
0

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

Quote 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
Reputation Points: 66
Solved Threads: 3
Junior Poster
liliafan is offline Offline
117 posts
since Apr 2004
Jul 28th, 2004
0

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

Quote 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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Specdro is offline Offline
3 posts
since Jul 2004
Jul 28th, 2004
0

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

From the look of the code on the next page:

PHP Syntax (Toggle Plain Text)
  1. <?php echo $ID; ?>

Should work.

HTH

Ben
Reputation Points: 66
Solved Threads: 3
Junior Poster
liliafan is offline Offline
117 posts
since Apr 2004
Jul 30th, 2004
0

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

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]
PoA
Reputation Points: 19
Solved Threads: 9
Posting Whiz in Training
PoA is offline Offline
234 posts
since Jul 2004
Jul 30th, 2004
0

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

What code are you actually using to fetch the ID on the next page?

Ben
Reputation Points: 66
Solved Threads: 3
Junior Poster
liliafan is offline Offline
117 posts
since Apr 2004
Aug 4th, 2004
0

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

[PHP]
$id = $_GET['id'];
[/PHP]

That's how you get $id on the following page.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
kenleycapps is offline Offline
9 posts
since Aug 2004
Aug 5th, 2004
0

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

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
huwgomez is offline Offline
6 posts
since Aug 2004
Aug 9th, 2004
0

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

Quote 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]
Reputation Points: 10
Solved Threads: 1
Newbie Poster
rice_web is offline Offline
11 posts
since Jul 2004
Jun 9th, 2006
0

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

I think he means how to access it..You would do this:

PHP Syntax (Toggle Plain Text)
  1. $id = $_REQUEST["id"];
Reputation Points: 10
Solved Threads: 0
Newbie Poster
evilfourzero is offline Offline
1 posts
since Jun 2006

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: Please Help me
Next Thread in PHP Forum Timeline: You have not selected search details.





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


Follow us on Twitter


© 2011 DaniWeb® LLC