0
What keyword to do this?
I have a table with 3 columm, NAME, DISTRICT, CITY. How can I present like this: I'm NAME, from DISTRICT, CITY for each row in SQL
3 Answers
+ 1
Hello Tri Pham.
That's fairly easy.
Assuming that you already have connection to your database.
<?php
$res = $mysqli->query("SELECT NAME, DISTRICT, CITY FROM table");
if($res->data_seek(0)){ // this will check if query has result
while ($row = $res->fetch_assoc()) {
echo "I'm" . $row['NAME'] . ", from " . $row['DISTRICT'] . ", " . $row['CITY'];
}
} else {
echo "no record";
}
?>
Hope that helps. :)
0
can you show me how to do that in MS SQL Server?
Like put a message in SQL studio. thanks for your help
0
save the php file(that Lyndon John Vergara given ) and run it