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

7th Nov 2016, 11:37 AM
Trí Phạm
Trí Phạm - avatar
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. :)
7th Nov 2016, 12:31 PM
Lyndon John Vergara
Lyndon John Vergara - avatar
0
can you show me how to do that in MS SQL Server? Like put a message in SQL studio. thanks for your help
7th Nov 2016, 12:35 PM
Trí Phạm
Trí Phạm - avatar
0
save the php file(that Lyndon John Vergara given ) and run it
7th Nov 2016, 2:27 PM
மனோஜ்குமார் பழனிச்சாமி
மனோஜ்குமார் பழனிச்சாமி - avatar