php - Show 3 top results according to date using sql -


I have a website, and I have created a library in it.

The table is: book

contains: book_id , book_title , book_cat , book_img , book_content , active , book_date , visits , book_sender )

'book_seender' is the identifier of the sender because any logged user can add books, I send the best sender (which sent a lot of books every week ), So I wanted to show the top 3 head To make a challenge between 3, sender of the week in a PHP file

  champion ---------- book_ id book_chitle book_cat book_img book_content active book_date code spetate (replace the appropriate value of db_name, db_user, and db_password): < < pre>  & lt ;? Php $ db = new PDF ('mysql: host = localhost; d bname = db_name; charset = UTF8', 'db_user', 'db_password'); $ Db- & gt; Set attribute (PDO :: ATTRRAMOD, PDO :: ERRMODE_EXCEPTION); $ Db- & gt; Set attribute (PDO :: ATTR_EMULATE_PREPARES, incorrect); $ Stm = $ db- & gt; Prepare (select "book_sender 'sender id', COUNT (*)` books sent from where the champs where book_date> DATE_ADD (now (), INTERVAL -7 DAY) book_sender LIMIT 0, 3 "by group) ; $ Stm- & gt; Executed (); While receiving ($ line = $ STM-> (PDO: FETCH_ASSOC)) {$ result [] = $ line; } // Step through the results and print? & Gt;   

Also assume that you are using MySQL and PDO.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -