I’m trying to extract the MAX streamitem_id from the streamdata table but when I change the query from SELECT streamitem_id to SELECT MAX(streamitem_id) it gives me the below error.
How can I rectify this issue?
This is the error I’m getting from Firebug.
SyntaxError: unterminated string literal
[Break On This Error]
var current_last_status_id="<br />
An below the client side code
<? $timestamp = "SELECT MAX(streamitem_id) FROM streamdata";
$chant = mysqli_query($mysqli, $timestamp) or die(mysqli_error($mysqli));
while ($streamitem_data= mysqli_fetch_array($chant)) {
?>
<script>
setInterval(function(){
var current_last_status_id="<?php echo $streamitem_data["streamitem_id"];?>";
$.ajax({ type: "GET",
url: "streampostinsert.php?current_last_status_id=" + current_last_status_id,
dataType:"json",
cache:false,
success: function(response){
Try changing the SQL to this
The error you are seeing in firefox is a javascript error, but I think the real error is that PHP is throwing a notice about undefined index streamitem_id in the middle of your javascript.
I believe you need to alias the returned value or you will have something along the lines of..
Which is a nightmare