Hi There,

I've set up a profile page where people can enter the address and then it displays all the information. However the URL doesn't seem grab the MySQL information for the certain ID.

How do I do it?

Example URL: http://www.website.com/profile.php?id=1

so when you go to that URL it gets information from the MySQL database in the field ID set at the end... so in this case number 1.

Then inside the profile.php it grabs all of the data from ID 1.

then I can echo it onto the profile.php page.

Ok so say we have users.php and i want to see someones profile using the "id" method. Just like what you said http://www.website.com/profile.php?id=1. Well if you have mysql database, just output the a field like names or something. Then with the name being outputed, just assign an href tag to them.. so
Page1.php

<?php
// connection
// output
$result = mysql_query("SELECT * FROM Persons");
while($row = mysql_fetch_array($result)) {
    echo "<a href='profiledispay.php?id=$row[id]'>".$row['FirstName']."</a><br>";
}
?>

Then on Page2.php

<?php
$id = $_GET['id']; // get var from URL
//connection
$result = mysql_query("SELECT * FROM Persons WHERE id = $id");
$row = mysql_fetch_array($result);
?>
<input type="text" value="<?php echo $row['FirstName']?>">

I really hoped this helped. basically when the user clicks on the name, the id is passed to page2 and you use the "get" method to grab the variable. Next we use it in the query to access only the row with that id. If you have further questions, please dont hesitate to ask.

Genius! Thanks so much, worked perfectly! :)

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.