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

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

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

Specdro
Newbie Poster
3 posts since Jul 2004
Reputation Points: 10
Solved Threads: 0
 
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

liliafan
Junior Poster
117 posts since Apr 2004
Reputation Points: 66
Solved Threads: 3
 
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 "<?$row[Name]
";



}


?>[/php]

Specdro
Newbie Poster
3 posts since Jul 2004
Reputation Points: 10
Solved Threads: 0
 

From the look of the code on the next page:

<?php echo $ID; ?>


Should work.

HTH

Ben

liliafan
Junior Poster
117 posts since Apr 2004
Reputation Points: 66
Solved Threads: 3
 

Try this.

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

{
echo "$row['Name']
";
}
?>[/PHP]

PoA
Posting Whiz in Training
237 posts since Jul 2004
Reputation Points: 26
Solved Threads: 9
 

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

Ben

liliafan
Junior Poster
117 posts since Apr 2004
Reputation Points: 66
Solved Threads: 3
 

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

That's how you get $id on the following page.

kenleycapps
Newbie Poster
9 posts since Aug 2004
Reputation Points: 10
Solved Threads: 0
 

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.

huwgomez
Newbie Poster
6 posts since Aug 2004
Reputation Points: 10
Solved Threads: 0
 

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]

rice_web
Newbie Poster
11 posts since Jul 2004
Reputation Points: 10
Solved Threads: 1
 

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

$id = $_REQUEST["id"];
evilfourzero
Newbie Poster
1 post since Jun 2006
Reputation Points: 10
Solved Threads: 0
 

Hehe ... you just resurrected a two year old thread.

cscgal
The Queen of DaniWeb
Administrator
19,421 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 229
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You