Help me build rating query to add rating

Discussion in 'Databases' started by co.ador, Jul 25, 2009.

  1. #1
    looking for an sql injection where I can display the total sum of each star that a item has been rated by users to better explain it I will post a pictures so you can see. I will also post a database dump so you guys have an idea of how the database is built.

    [​IMG]


    database dump

    --
    -- Database: `menu`
    --

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

    --
    -- Table structure for table `rating`
    --

    CREATE TABLE IF NOT EXISTS `rating` (
    `item_name` varchar(100) NOT NULL,
    `ip_address` varchar(15) NOT NULL,
    `rating` tinyint(1) NOT NULL,
    `date_rated` date NOT NULL,
    PRIMARY KEY (`item_name`,`ip_address`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1;


    The rating field is a number from 1 to 5 is recorded in there and it will vary according to the user rate. and that's the field I want to retrieve and sum all the 1 rating the 2 rating 3 ratings of item-name "X"
     
    co.ador, Jul 25, 2009 IP