Me and a friend of mine have started a project (no school involved, all personal) and it is functioning really well. I thought about the ideas, designed visuals and he did the PHP and MYSQL programming.
He is away now, and currently don’t have a Internet connection where he can sit down and work on PHP so I thought about couple of ideas, even though I don’t really know how PHP and MYSQL connects I tried to implement them and since I am studying a Computer Engineering, I thought the idea should be similar but the experience.
So here is my problem:
There is a table named ‘comments’. It has rows which has fields of id, comment, author, super
So on the page, which is index.php I want to randomly pick a row ‘which’ has a super = 1. If it is 0, it is not going to be in the list of possible items.
There are 3 files.
db.php - > Connects to database and includes information like database name, password and stuff like that.
theme.php - > The theme basically
index.php - > Connects to database using db.php and then uses lots of calculations to print it into the page using the theme.
My question is, what kind of function would I write and on which of the files would I do it?
To remind you, it is going to look for a random item in ‘comments’ row which has a field **super **that equals to 1.
I’d be glad if you could help me on this.