Forum Moderators: coopster

Message Too Old, No Replies

Problem with output ticket on php/mysql/javascript

         

webstyler

12:03 pm on Aug 4, 2005 (gmt 0)

10+ Year Member



Hi, I have ticket javascript that require this simple code :
...
var marqueecontent="\
<span class='newstiker_data'>20.01.2005</span> <a href='#' class='newstiker'>News1</A> \
<span class='newstiker_data'>27.01.2005</span> <A href='#' class='newstiker'>News2</A> \
";
...

Now I must take news from mysql so I write :

<?
$sql = "SELECT * FROM $dbtablenews ";
$result = mysql_query($sql) or die ("Sql error : $sql");
$numerorecord = mysql_num_rows($result);
if( $numerorecord >= 1 )
{
echo "var marqueecontent=\"\ \n";
while ($row = mysql_fetch_array($result))
{
$data = substr($row[data],4,2).".".substr($row[data],6,2).".".substr($row[data],0,4);
echo '<span class="newstiker_data">$data</span> <A href="#" class="newstiker">$row[title]</A> \ \n';
}
echo "\"; \n";
}
?>

BUT

I have javascript error when opern page that said :"marqueecontent is not define"..

If I check html code all it's ok

why javascript var is not use?

thks

jatar_k

4:21 pm on Aug 4, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I am assuming the top chunk works

have you checked the source of the page to see if there are any obvious syntax errors in the js that is output to the browser?