In the beginning, each person have 2 languages of messages (chimessage & engmessage)saved to the database.
Each of them have selected a preferred language (either chi or eng). In the display page, i'm trying to show each person's message with their preferred language. eg, If person A prefer eng, the page will only show engmessage.
PS the display page will include both engmessage and chimessage for different people
I am wondering how can i do that, im thinking using the if/else statement.
PS I know iam using deprecated mysql,still trying to learn php, plz bear with me
<?php
include('connect-db.php');
$result = mysql_query("SELECT * FROM table
WHERE language ='Chi' OR language ='Eng'");
while($row = mysql_fetch_array( $result ,MYSQL_ASSOC)) {
echo "<tr>";
echo '<td width="200px">' . $row['people'] . '</td>';
echo '<td width="200px">' . $row['language'] . '</td>';
echo '<td>' . $row['chimessage'] ."<br />";
echo '<td>' . $row['engmessage'] ."<br />";
}
echo "</tr>";
echo "</table>";
?>
Expected result
People Language Msg
A Chi 物理治療
B Eng Physiotherapy