<?php
class Country{
 
    // database connection and table name
    private $conn;
    private $table_name = "wp_messagecountries";
 
    // object properties
    public $id;
    public $name;
    public $description;
    public $price;
    public $category_id;
    public $category_name;
    public $created;
 
    // constructor with $db as database connection
    public function __construct($db){
        $this->conn = $db;
    }

    // read products
    function read( $lcode = 'es' ){

        $last_update = '';
        
        $sql = "SELECT 
                country_code,
                country_name
                FROM wp_messagecountries m
                WHERE m.language_code = '$lcode'";

        $stmt = $this->conn->prepare($sql);
    
        // execute query
        $stmt->execute();
    
        return $stmt;
    }
}
