Ok, So I have a external php script that get data from a DB and displays it in a table. I want to run it in a specific div in my html so the data gets echoed out in the right place?
Any ideas how to do that?
Html div
<div id="statsContent">
<?php include('updatestats.php'); ?>
</div>
Heres the PHP code.
<?php
//Start session
session_start();
//Make sure user is logged in
require_once('auth.php');
//Include database connection details
require_once('config.php');
//Connect to DB
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if(!$link) {
die('Failed to connect to server: ' . mysql_error());
}
//Select database
$db = mysql_select_db(DB_DATABASE);
if(!$db) {
die("Unable to select database");
}
//Create Querys
$query = "SELECT * FROM stats WHERE member_id='" . $_SESSION['SESS_MEMBER_ID'] . "' ";
$result = mysql_query($query);
//Gather the whole row into an array
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$money = $row['money'];
$bank_money = $row['bank_money'];
$ap = $row['ap'];
$exp = $row['exp'];
}
//Now create a table to display the data to the user
echo "<table>
<tr>
<td>Money $$money</td>
<td>Action Points $ap</td>
<td>Experience $exp</td>
</tr>";
?>