Basically, this is what I am doing: I have a flash/ajax file uploader where users can select x amount of photos and upload them and then they are inserted into a MYSQL database by an external php script.
After they are inserted in the database, I would like to display them on the page and allow the users to edit the tags, caption, etc.
However, I cannot figure out how to "Live update" the page to display the correct data
Take this for example: showFields() is ran once he upload is complete;
function showFields() {
var jsvar = '<?php echo getIDs(); ?>';
document.getElementById('picndata').innerHTML += jsvar;
}
which will work if I have getIDs just return a static value such as "test"
but if i were to have it do this:
function getIDs() {
$SQL = "SELECT * FROM `slides` ORDER BY `sid` DESC";
$results = mysql_query($SQL);
$row = mysql_fetch_assoc($results);
$slide = $row['sid'];
$SQL = "SELECT * FROM `slides` WHERE `sid` = $slide";
$results = mysql_query($SQL);
$str;
while ($row = mysql_fetch_array($results)) {
$str .= $row['size'] . "\r\n";
}
return $str;
}
(sloppy I know)
, then it will not work because the PHP is ran first and so it does not find any results because the images were not uploaded yet!
Any ideas?