Jump to content

[SOLVED] what does this error mean?


EchoFool

Recommended Posts

Ok its a little complex so bare with me :

 

PHP Script: (load certain data for list)

root/subfolder


<script language="javascript">
function games(){
var url = document.location.href; 
var xend = url.lastIndexOf("/") + 1;
var base_url = url.substring(0, xend); 
// var base_url = '../pokerbackup/includes/';
// thisurl = base_url + 'live_games.php';
//document.write(base_url);
thisurl = base_url + 'live_gamestest.php';
checkloadfile(thisurl, "js"); 
setTimeout("games()", 3000);  // games() is using an onload on the body line in this script below
} 
</script>

<body bgcolor="#000000" text="#CCCCCC" onLoad="games();">
<div id="gamelist" style="border : solid 0px   padding : 1px; width : 100%; height : 365px; overflow : auto; ">

</div ><br>
<?php
$tableq = mysql_query("select p1ID, p2ID,tablename,tablelimit,tabletype,hand,tablelow from table order by tablelimit asc ") or die(mysql_error());
while($tabler = mysql_fetch_array($tableq)){ 
$i = 1;
$x=0;
while($i < 11){
if($tabler['p'.$i.'ID'] != '' OR $tabler['p'.$i.'ID']< 1){ $x++; }
$i++;
}
$tableplayers = $x.'/10';
$tablestatus = (($tabler['hand'] == '')? 'New Game' : 'Playing');
$tabletype = (($tabler['tabletype'] == 't')? 'Tournament' : 'Sit \'n Go');
}		
?>

 

JS script: (when call list all chat rooms and display them in div id "gamelist"

root/subfolder/includes/

<script language='javascript'>


<?php
include($_SERVER['DOCUMENT_ROOT'].'/css/includes/bconnect45/connect.php');
include($_SERVER['DOCUMENT_ROOT'].'/css/includes/afunctions23/functions.php');
// require('gen_inc2.php');
?>
var gameslist = '<table border="0" cellspacing="0" cellpadding="3" width="100%" class="smllfontwhite">';
<?php
$tableq = mysql_query("select gameID, p1ID, p2ID,p3ID, p1pot, p2pot, p3pot, tablename,tablelimit ,tabletype,hand,tablelow, pot from poker order by tablelimit asc ") or die(mysql_error());

while($tabler = mysql_fetch_array($tableq)){ 
//get variables etc

?>
        gameslist += '<tr onMouseOver="this.bgColor = \'#330000\'; 
this.style.color = \'#FFFFFF\';" onMouseOut="this.bgColor = \'\'; this.style.color = \'#FFFFFF\';"  onClick="selectgame(\'lobby.php?gameID=<? echo $gID; ?>\');" class="hand">';

        gameslist += '<td class="smllfontwhite" width="120"><?php echo $tablename; ?></td><td width="50" align="center"
class="smllfontwhite"><?php echo $tableplayers; ?></td><td class="smllfontwhite" width="80" align="center"><?php echo $tabletype;
?></td><td class="smllfontwhite" width="90" align="center"><?php echo $buyin; ?></td><td class="smllfontwhite" width="90"
align="center"><?php echo $SB; ?></td><td class="smllfontwhite" width="90" align="center"><?php echo $BB; ?></td><td class="smllfontwhite" width="80" align="center"><?php echo $tablestatus; ?></td></tr>';

<?php
} 
?>
      gameslist += '</table>';
  document.getElementById('gamelist').innerHTML = gameslist;

 

 

I don't know how to make javascript colourful like php does in these code tags sorry.. the basic idea is .. in body it onloads (games()) function in the JS in the first script.

This calls a second js script which loads list of rooms and does it every 3 seconds to keep the list "live" as it were without refresh required... but as you know it errors.. hope you can help. It is meant to display the content in the div on the first script with the id of gamelist

Link to comment
Share on other sites

There is no output thats the problem... the only output is basically what is loaded outside the javascript.. and i did check the while loop it is loading 1 row, so it should load one load from the javascript.

 

But the page source shows:

<div id="gamelist" style="border : solid 0px   padding : 1px; width : 100%; height : 365px; overflow : auto; ">
</div >

 

Thats it but firebug addon on FF shows:

unexpected end of XML source

[break on this error] document.getElementById('gamelist').innerHTML = gameslist;

Link to comment
Share on other sites

No, I mean run your scripts that have the php in them, and show us the output. You showed a bunch of code with php in it. The php is irrelevant - only the output of the php matters. So if you run the php script, then view the source, we can see the raw javascript code.

Link to comment
Share on other sites

Argh wait i got it working on a much easier script using:

 

<script type="text/javascript">
var auto_refresh = setInterval(
function ()
{
$('#load_tweets').load('live_gamestest.php')..fadeIn("fast");
}, 1000); // refresh every 1000 milliseconds
</script>	
 <div id="load_tweets">

 </div> 

 

Now its basically just like having a php include with output ! Unless you know a simpler way? Its working so far.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.