I am trying to display the output of a sql query on 3 different lines using the echo function. The php code is enclosed inside a div tag. My code is below
<div class="ClientAdress" id="ClientAdress">
<?php
$db = new SQLite3( 'Stock_Control.sqlite');
$sql = 'SELECT City,County,Street_Adress FROM Customer WHERE Customer_ID = 14';
$result = $db->query($sql);//->fetchArray(SQLITE3_ASSOC);
$row = array();
$i = 0;
while($res = $result->fetchArray(SQLITE3_ASSOC)){
if(!isset($res['City'])) continue;
$row[$i]['City'] = $res['City'];
$row[$i]['County'] = $res['County'];
$row[$i]['Street_Adress'] = $res['Street_Adress'];
$i++;
}
echo $row[0]['City'];
echo $row[0]['County'];
echo $row[0]['Street_Adress'];
?>
</p>
</div>
The current output is "BurgasBurgasplaces"
Edit:
This is what I tried:
<div class="ClientAdress" id="ClientAdress">
<?php
$db = new SQLite3( 'Stock_Control.sqlite');
$sql = 'SELECT City,County,Street_Adress FROM Customer WHERE Customer_ID = 14';
$result = $db->query($sql);//->fetchArray(SQLITE3_ASSOC);
$row = array();
$i = 0;
while($res = $result->fetchArray(SQLITE3_ASSOC))
{
if(!isset($res['City'])) continue;
$row[$i]['City'] = $res['City'];
$row[$i]['County'] = $res['County'];
$row[$i]['Street_Adress'] = $res['Street_Adress'];
$i++;
}
echo $row[0]['City'] . "<br />\n";;
echo $row[0]['County'] . "<br />\n";;
echo $row[0]['Street_Adress'] . "<br />\n";;
?>
</div>
echo $row[0]['City'].'<br>';?ptag, or your opening it in the wrong place