Jump to content

Read MySQL Table then post information


Chidori Soul

Recommended Posts

You probably want your DB tables to be set up like -

 

Table users

id PRI

name

.

.

.

 

Table profilefields

user_id PRI

field1

field2

field3

.

.

.

 

Tables are incomplete, but you get the idea. So in your PHP script, you can have a URL like http://domain.com/profile.php?id=1 where the id part is the ID of the user in the users table. Then you query the DB looking up the info you need in the profilefields table.

Link to comment
Share on other sites

This is an example of how you would query a table and display the results.

 

$result=mysql_query("SELECT * FROM mytable");

while ($row = mysql_fetch_array($result)) {

  $name = $row[name];

  $age = $row[age];

  echo "$name is $age year(s) old<br>";

}

 

You would simply adjust the table name and values for columns you are looking to retrieve.  Hopefully this points you in the right direction.

Link to comment
Share on other sites

Oh, Thanks!

 

Now, I just need to know on how to make one page for each user, and have it add another ID for each user registered

 

like this: profile.php?id=1

 

now, if ID 2 registers, they could click View Profile, and it would be: profile.php?id=2, and if ID 3 clicks it...etc

 

Would this have to do with Cookies or Sessions?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.