php java script
| From: | AJDIN BRANDIC | Date: | Fri, 14 Sep 2001 15:07:05 +0000 |
| Subject: | php java script | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-67376@lists.php.net to get a copy of this message | ||
Hi
I am doing a scroll bar with javascript and info pulled from MySQL.
So I execute query and create an array with php called messages. Then
when my page is loaded I guess this array should be available to
JavaScript under the same name except the $. Am I right here or not?
The java script error is : messages not defined
the code is:
<html>
<body>
<table>
<tr><td>Scroll Text</td></tr>
<tr><td>
<script language='JavaScript1.2'>
<?php
include("mydbconnection.php3");
if(gettype($messages) != "array")
{ $messages = array(); }
$query="select * from text";
$results=mysql_query($query);
while($result = mysql_fetch_array($results)) {
$texttitle=$result['title'];
$body=$result['body'];
$mytext=$texttitle;
$mytext=$body;
array_push($messages, $mytext);
}
reset($messages);
?>
if(messages.length>1) {
id=1
}
...........................
</script>
</td></tr></table>
</body>
</html>
Regards
Ajdin