structuring some php queries

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
as1609
Forum Newbie
Posts: 1
Joined: Thu Mar 06, 2014 9:05 am

structuring some php queries

Post by as1609 »

Hi, I am very new to php and mysql and have been struggling for a while with something that may be fairly simple.

This is what I have created:
A website where members can login and upload a profile picture.  Their profile picture is saved in a folder as member.jpg (where member is their username), and their username and password are saved in a mysql table. So when Adam creates a profile he will have a picture called adam.jpg and his username, adam, will be saved in the first column of the table.

This is what I am now trying to create: A page that displays a single user's picture. After logging in, if I (I am another user) like the picture I click a like button. If not I click a dislike button. This causes the next user's picture to show up and I can like or dislike it, and I can thus cycle through all users who I have not previously liked/disliked. If I like a user then a database 'like' table will populate with my name in the first column and other users name in the second column. If I dislike a user my name will populate in the first column of a 'dislike' take and three other user's name in the second column.

If someone could tell me basically how I can structure this using php I would really appreciate it. I am familiar with most php and mysql commands but I just don't know which ones I should use to create this efficiently. So if someone could point me to what commands, arrays, etc. I should use and in what order I would be really grateful.

Thank you
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: structuring some php queries

Post by Celauran »

A join table containing voting user, user voted on, and score should suffice, I would think.
Post Reply