Page 1 of 1

structuring some php queries

Posted: Thu Mar 06, 2014 9:08 am
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

Re: structuring some php queries

Posted: Thu Mar 06, 2014 9:11 am
by Celauran
A join table containing voting user, user voted on, and score should suffice, I would think.