Jump to content
Larry Ullman's Book Forums

Recommended Posts

hey everybody,

 

i have  a request here,i'm a newbie in which called php and mysql..

i have finished the HTML of my website and now i want to implement

a sidebar for Most Popular Posts..

i'masking if u can afford me with a tutorial from the scratch to build my sidebar? plz?

 

thanks in advance :mellow:

Link to comment
Share on other sites

You need to follow these steps to implements such functionality:

 

1. Keep track of views. This can be saved in your post/article/etc table along with other info, or in a separate table with a foreign key to the article ID. Each time an article is loaded using PHP, simply update the views column in the table. (You might also use flat-files, the principle is the same)

 

2. Query for articles based on views. The basic query looks something like this:

SELECT * FROM articles ORDER BY views DESC LIMIT 10
  • Upvote 2
Link to comment
Share on other sites

 

You need to follow these steps to implements such functionality:

 

1. Keep track of views. This can be saved in your post/article/etc table along with other info, or in a separate table with a foreign key to the article ID. Each time an article is loaded using PHP, simply update the views column in the table. (You might also use flat-files, the principle is the same)

 

2. Query for articles based on views. The basic query looks something like this:

SELECT * FROM articles ORDER BY views DESC LIMIT 10

i understand a bit what is a database and what is a table, the Query u gave me is exactly what i 'm using, the problem that bothers me is the php code.. i mean how to connect between the HTML and MySQL

 

thanks alot for helping

Link to comment
Share on other sites

 Share

×
×
  • Create New...