Jump to content

Pages like: index.php?(information here)


Zoud

Recommended Posts

Usually you store your data in a database, then look up a specific record via an id. So... if you have a link to index.php?uid=4 this could would display data related to uid 4.

[code]
<?php
  // connect to db
  if (isset($_GET['uid'])) { // $_GET['uid'] holds the data passed through the url.
    $sql = "SELECT uname FROM tbl WHERE uid = '{$_GET['uid']}'"; // really should validate $_GET['uid'] before trying to use it, but....
    if ($result = mysql_query($sql)) {
      if (mysql_num_rows($result) > 0) {
        $row = mysql_fetch_assoc($result);
        echo $row['uname']."<br />";
      } else {
        echo "No results found matching {$_GET['uid']}";
      }
    } else {
      mysql_error();
    }
  }
?>
[/code]
That's basicly what I thought, but now there's just one more problem.  I don't know as much stuff about MySQL as I do with PHP and other stuff. So, how would I be able to customize the content in the table to the content on the page?

I think it's using the $_GET and/or $_POST tag's, right?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.