Jump to content

The concept of user folders

- - - - -

  • Please log in to reply
3 replies to this topic

#1
Padawan

Padawan

    Newbie

  • Members
  • PipPip
  • 15 posts
Hello everybody,

The application I'm building, the registered user should be able to create multiple photo albums where he can store the images he uploads. Being a PHP beginner, I need some suggestions on how to make that available. I have set a table in the database which should hold the album name and id. But I have some trouble around that whole thing. Do I need a different HTML page for every folder, which functions should interact with the database for creating an album, how to display and navigate through multiple albums, etc?

I'm not asking for a code, just for some suggestions about the whole concept. I'd be very grateful if you throw me some ideas. :)

Thank you very much.

#2
Vaielab

Vaielab

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 547 posts
You should use $_GET variable.
If your url is localhost/index.php?page=5
In the $_GET variable you will have the index page set to 5
In a other word, if you do echo($_GET['page']); it will print 5
?page can be anything, and you can pass multiple value, separated by an &
So it can be index.php?page=3&index=Hi&categorie=2

With that in mind, you get the id of the album via a $_GET parameter, and fetch the sql with the id inside the where clause.
So only 1 page will be needed, but depending on the $_GET data you pass to it, you will have different data on this page

#3
Padawan

Padawan

    Newbie

  • Members
  • PipPip
  • 15 posts
Thank you!

Any code snippets or links to a tutorial using the $_GET variable in the case above is welcomed. I made a page now, dashboard.html which should have the option of browsing existing albums, uploading new photos and creating new albums.

#4
bbqroast

bbqroast

    Codecall Addict

  • Members
  • PipPipPipPipPipPipPip
  • 554 posts
  • Location:/etc/passwd
Yes use the $_GET variable the photo or album ID then find it in the MySQL DB in an albums case each image should have a 'album ID' so you can say WHERE 'abumIB' = $albumID. The MySQL DB also has the randomly generated name of (name generated when uploaded) the image (storing it in the DB bloats your DB and can cause performance issues) then you can
 echo "<img src='/images/user/$imageName'>"
Also $_GET:
$id = $_GET['i']
if you visited /path/page.php?i=1 id would be set to one... Make sure you sanitize your input!
Please, write clearly with proper structure. Double spacing makes the text feel un-jointed, Capitalizing Every Word Means People Stop Before Every Word Sub-Consciously Which Is A Pain In The Backside, and use code tags! (The right most styling box).




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users