Ajax Jquery Mysql Like dislike on all posts with certification count.

Ajax Jquery Mysql Like dislike on all posts with certification count.

Hello.  I have nice ajax php and mysql code that will insert and query a remote MySQL DB.  The client side uses no php code, and just calles to a remote MySQL DB in case I want to use the code in a mobile app as well.  What I am struggling with, is finding exmaples to modify my code, to include a like or dislike button for queried articles or records.  It would be nice if not only could I like or dislike, we could update a certified field in the table once like or yeses were over 50.  So for exmaple:  Please see screen mockup attached. 

Please as well see code attached.  The attached code  currently does a query to the DB and Table.

Any help for the like and dislike code, that falls within and works with my code would be greatly appreciated.  I have scoured the internet but most of the code I see is client sode.  I need the Ajax to pass the code to the server side, as per the reasons stated above.  Thanks in advance.

I found this example:


The general premis is good, but it lacks:

- an indivudual count per each record
- An indivual id that can be referenced via an article or post id in the current or another database
- I'm not sure how I would perform the php/sql update query for if the records were over 50 likes or yeses