Hi Guys,

Iím using a vertical scrolling Javascript, and I want to embed the following php into it:

PHP Code:
<?
// select all records ordered by date
$SQL "Select * FROM `cms_hot_jobs`";

// make the query (assume connection is there)
$result mysql_query($SQL) OR die(mysql_error());

// iterate the result set
while ($row mysql_fetch_assoc($result)){
echo 
"".stripslashes($row['title'])."<br />";
echo 
"".stripslashes($row['organisation'])."<br />";
echo 
'<a class="more" onclick="WinOpenJob('.$row['job_id'].')")  href="javascript:void(0)">[ More ]</a>';
echo 
"<br /><br />";
}
?>
However, if I just copy and paste the php in the var scrollercontent below it simply outputs a javascript error. Can this work by using this php statement in the below javascript code?

Thanks

Chris

HTML Code:
<table width="185" height="450" border="2" cellpadding="0" cellspacing="0" bordercolor="#666666">
  <tr>
    <td><script language="JavaScript1.2">
	
// Distributed by http://www.hypergurl.com // Scrollers width here (in pixels) 

var scrollerwidth="185px"

var scrollerheight="450px"

var scrollerspeed=1

var scrollercontent='This is where I want the php to go'

var pauseit=3

scrollerspeed=(document.all)? scrollerspeed : Math.max(1, scrollerspeed-1)
var copyspeed=scrollerspeed
var iedom=document.all||document.getElementById
var actualheight=''
var cross_scroller, ns_scroller
var pausespeed=(pauseit==0)? copyspeed: 0

function populate(){
if (iedom){
cross_scroller=document.getElementById? document.getElementById("iescroller") : document.all.iescroller
cross_scroller.style.top=parseInt(scrollerheight)+8+"px"
cross_scroller.innerHTML=scrollercontent
actualheight=cross_scroller.offsetHeight
}
else if (document.layers){
ns_scroller=document.ns_scroller.document.ns_scroller2
ns_scroller.top=parseInt(scrollerheight)+8
ns_scroller.document.write(scrollercontent)
ns_scroller.document.close()
actualheight=ns_scroller.document.height
}
lefttime=setInterval("scrollscroller()",20)
}
window.onload=populate

function scrollscroller(){

if (iedom){
if (parseInt(cross_scroller.style.top)>(actualheight*(-1)+8))
cross_scroller.style.top=parseInt(cross_scroller.style.top)-copyspeed+"px"
else
cross_scroller.style.top=parseInt(scrollerheight)+8+"px"
}
else if (document.layers){
if (ns_scroller.top>(actualheight*(-1)+8))
ns_scroller.top-=copyspeed
else
ns_scroller.top=parseInt(scrollerheight)+8
}
}

if (iedom||document.layers){
with (document){
if (iedom){
write('<div style="position:relative;width:'+scrollerwidth+';height:'+scrollerheight+';overflow:hidden" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=scrollerspeed">')
write('<div id="iescroller" style="position:absolute;left:0px;top:0px;width:100%;">')
write('</div></div>')
}
else if (document.layers){
write('<ilayer width='+scrollerwidth+' height='+scrollerheight+' name="ns_scroller">')
write('<layer name="ns_scroller2" width='+scrollerwidth+' height='+scrollerheight+' left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=scrollerspeed"></layer>')
write('</ilayer>')
}
}
}

</script></td>
  </tr>

</table>
</body>
</html>