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

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

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.

$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>";
 
 
 
}
 
 
?>

From the look of the code on the next page:

<?php echo $ID; ?>

Should work.

HTH

Ben

Try this.

<?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>";
}
?>

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

Ben

$id = $_GET['id'];

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

Try this as the query on ur second page. worked for me. (Got this off Roberdin)

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


Huw.

Try this as the query on ur second page. worked for me. (Got this off Roberdin)

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


Huw.

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

$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");

}

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

$id = $_REQUEST["id"];

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.