Okay I made some changes to my javascript and also added some code to the beginning of my php. Can you tell me why I am getting this error (Call to a member function on a non-object)?
Code:
function view(){
createXMLHttpRequest();
loadingMessage();
var date = new Date();
var timestamp = date.getTime();
var poop = true;
var queryString = "poop=" + poop;
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.open("GET","oopClasses.php?"+ queryString + "&time=" + timestamp,true);
xmlHttp.send(null);
}
PHP Code:
<?php
if(isset($_GET['poop']) && $_GET['poop'] == 'true'){
$test = new Maps();
MapIt();
}
class Maps
{
function viewmaps()
{
GLOBAL $sybconnect;
$sql="select distinct cellname,centname from celltech order by cellname";
$link=$sybconnect->query($sql);
$i=0;
while($row=$sybconnect->fetchArray($link)){
$output[$i]['cellname']=$row['cellname'];
$output[$i]['centname']=$row['centname'];
$i++;
}
//$connect->close();
return $output;
}
function MapIt(){
if(isset($this)){
//user wants to see the maps
$maps = new Maps();
$displaysite = $maps->viewmaps();
?>
<div style="height:400px;overflow:auto">
<table>
<tr>
<th>Cell Name</th>
<th> </th>
<th>Centname</th>
</tr>
<?php
for($i=0;$i<count($displaysite);$i++){
?>
<tr>
<td><strong><?php echo $displaysite[$i]['cellname'];?> (<a href="http://<?php echo $_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'];?>?option=cellname&task=editmap&cellname=<?php echo $displaysite[$i]['cellname'];?>">Edit</a>)</strong></td>
<td>maps to</td>
<td><strong><?php echo $displaysite[$i]['centname'];?></strong></td>
</tr>
<?php
}
?>
</table>
</div><?php
}
}
?>
Bookmarks