I want to transfer data from a MySQL database, select the column related to the language of values from my goal.
MySQL table's name is catalogs
Mysql column names are id
, name_en
, name_de
, name_ru
, content_en
, content_de
, content_ru
, image
language short code comes from _GET
request
For example, the URL looks like the following
catalogs.php?id=1&lan=en
My PHP Code Looks like the following
$get_id = $_GET['id'];
$lan = $_GET['lan'];
$sql = $mysqli -> query("SELECT id, name_$lan, content_$lan, image FROM catalogs WHERE id='$get_id'");
while($row = $sql->fetch_array()){
echo $row['name'];
//nothing display
}