Reputation: 45
The below code included in php file and gets data from data base
$sqlUrl = "SELECT *
FROM $category
WHERE sub_category = '$subCategory'";
$result = mysqli_query($con,$sqlUrl);
now I need to display those data on the screen and thus I would like to load them on am html file in a specific division
<div id="div6">
</div>
I think that I can do it using JScript but I don't know how to do it
Upvotes: -1
Views: 59
Reputation: 1011
why you want to display results with JScript? You can do it like this also:
<div id="div6">
<?php
while ($row = mysqli_fetch_assoc($result)) {
echo $row["Name"]."<br />";
}
?>
</div>
for more details Plese refer: https://www.php.net/mysqli_fetch_assoc
Upvotes: 0
Reputation: 3953
What the ... If you just want to print it, you dont need JavaScript:
<div id="div6">
<?php foreach($result as $r) {
echo $r;
} ?>
</div>
Upvotes: 1