Jump to content

Php MySql dynamic table populate


larry777

Recommended Posts

Greetings, I'm a Php newbie and am developing a photo album site and have the basic framework in place with user registration, login, and then a page that you can upload images to MySql and those images are displayed below. What I am trying to do is create a system whereby when a user logs in they are sent to a page that shows a table with THEIR images that they have uploaded.. kinda creating the users very own page. I'm sure this is possible but am stumped. Please help if you can : )
Link to comment
https://forums.phpfreaks.com/topic/34712-php-mysql-dynamic-table-populate/
Share on other sites

Hey,

What I would do is have a db table which contains the user id against the pic url, say user_img:

[table][tr][td][b]user_id[/b][/td][td]|[/td][td][b]url[/b][/td][/tr][tr][td]1234[/td][td]|[/td][td]img/picture.gif[/td][/tr][/table]

so when they log in you can query the table:

[code]
select url from user_img
where user_id = [current_user]
[/code]

then for each of the returned rows output the url within the img tag:

[code]<img src="<?=$url_variable?>">[/code]

Hope this helps,

Angus.

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.