Hello, I was wondering how I can grab information from the mysql database and place that information into a specified HTML div element.
Here is my PHP that I am using to connect to the database:
Any help would be great. Thanks.PHP Code:<?php
$mysql = new mysqli('localhost', 'root', 'root', 'ajax_demo') or die('you\'re dead');
$result = $mysql->query("SELECT * FROM explore") or die($mysql->error);
if($result) {
while($row = $result->fetch_object()) {
$siteName[] = $row->site_name;
$siteDescription[] = $row->site_description;
$siteURL[] = $row->site_url;
$sitePrice[] = $row->site_price;
# note that this isn't ideal - to echo out text before the doctype. This is just for example. In a real-world app, we'd echo this info out within the container div.
}
}


Reply With Quote
Bookmarks