Sistema de comentarios PHP con me gusta y no me gusta

PHP comment system with likes and dislikes

This PHP comment system with likes and dislikes, allows the end user very easily, without prior registration, just by putting their information as a reviewer, to leave in the system the message that is required to be left, in turn these messages can be qualify with likes and dislikes in a very simple way.

This application has been designed and implemented in PHP, MySQL and Bootstrap at a very basic level.

Explanatory video (spanish)

Setting up the PHP comment system with likes and dislikes on a local server

Previous Applications

To install the application on a local server, I recommend the prior installation of the following applications:

XAMPP, Git, Visual Studio Code

XAMPP is the application in charge of implementing a apache server for them to work scripts PHP on a local computer.

Git is the world's most widely used repository manager, with which you can cleanly download code from GitHub.

Visual Studio Code is the world's most popular code editor, which I highly recommend in virtually every post on this blog.

Download GitHub App

The following is the GitHub repository download link for the PHP Commenting System on a local server:

Configuration of the PHP comment system with likes and dislikes for its operation on your computer

You must install the mentioned applications, with all the default parameters, after this procedure, from Visual Studio Code, you must open the following location:

C:\xampp\htdocs

From this location in Visual Studio Code, click View, Terminal. Inside the Terminal you choose the Git Bash option and copy the following code:

git clone https://github.com/configuroweb/comentarios.git

The comments folder will be created, inside the htdocs folder

PHP Comment System Database with likes and dislikes

For the application to work correctly PHP script to export table to Excel you will require the database, you must create a database with the name comentarios I have import the SQL code below:

-- phpMyAdmin SQL Dump
-- version 5.1.1
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 27-04-2022 a las 20:56:16
-- Versión del servidor: 10.4.21-MariaDB
-- Versión de PHP: 8.0.11

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Base de datos: `comentarios`
--

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `comentario`
--

CREATE TABLE `comentario` (
  `comentario_id` int(11) NOT NULL,
  `parent_comentario_id` int(11) DEFAULT NULL,
  `comment` varchar(200) CHARACTER SET latin1 NOT NULL,
  `comment_sender_name` varchar(40) CHARACTER SET latin1 NOT NULL,
  `date` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Tabla Comentarios';

--
-- Volcado de datos para la tabla `comentario`
--

INSERT INTO `comentario` (`comentario_id`, `parent_comentario_id`, `comment`, `comment_sender_name`, `date`) VALUES
(4, 0, 'Me fascina la programacion, muy interesante.', 'Luisa Maron', '2018-03-23 04:50:37'),
(5, 0, 'Los lenguajes de programacion nos ayudan a crear plataformas de todo tipo', 'Claudia Guillen', '2018-03-23 05:09:48'),
(6, 0, '  Excelente idea, muchas gracias ', 'Pedro Programador', '2022-04-26 05:36:39'),
(7, 6, '  Por nada a la orden', 'Juan Programador', '2022-04-26 05:37:20');

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `megusta_nomegusta`
--

CREATE TABLE `megusta_nomegusta` (
  `id` int(11) NOT NULL,
  `member_id` int(11) NOT NULL,
  `comentario_id` int(11) NOT NULL,
  `like_unlike` int(2) NOT NULL,
  `date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Volcado de datos para la tabla `megusta_nomegusta`
--

INSERT INTO `megusta_nomegusta` (`id`, `member_id`, `comentario_id`, `like_unlike`, `date`) VALUES
(2, 1, 3, 1, '2018-03-22 23:09:56'),
(3, 1, 5, 1, '2018-03-22 23:09:52'),
(4, 1, 4, 1, '2018-03-22 23:09:53'),
(5, 1, 6, 1, '2022-04-25 22:37:04'),
(6, 1, 7, 1, '2022-04-25 22:37:26');

--
-- Índices para tablas volcadas
--

--
-- Indices de la tabla `comentario`
--
ALTER TABLE `comentario`
  ADD PRIMARY KEY (`comentario_id`);

--
-- Indices de la tabla `megusta_nomegusta`
--
ALTER TABLE `megusta_nomegusta`
  ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT de las tablas volcadas
--

--
-- AUTO_INCREMENT de la tabla `comentario`
--
ALTER TABLE `comentario`
  MODIFY `comentario_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT de la tabla `megusta_nomegusta`
--
ALTER TABLE `megusta_nomegusta`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

Next, open XAMPP on your computer, activate the Apache service, and you will be able to see the application at the following URL:

http://localhost/comentarios/

PHP comment system upload with likes and dislikes

Due to the simplicity of the application, I will not address the issue directly, in the following related video (spanish), I explain the process at a general level:

Upload page with PHP + Database (MYSQL) to a Hosting

If you still have doubts about the process of setting up the application on a local server

How to Install PHP Applications on a Local Server

Any questions I remain pending, if you require more PHP applications, in Python or JavaScript I recommend you subscribe to my content on Youtube and be on the lookout for any changes, that I make.

3 comments

  1. Hola Mauricio, Excelente video, gracias por compartir tus conocimientos. Lo instale exitosamente y todo funciona perfecto. Felicidades y exito! Saludos desde Los Angeles.

Leave a Reply

Your email address will not be published.