# Php echo'ed js

**URL:** <https://forum.kirupa.com/t/php-echoed-js/252372>\
**Category:** Uncategorized\
**Created:** [February 19, 2008, 3:35pm UTC](https://forum.kirupa.com/t/php-echoed-js/252372 "2008-02-19T15:35:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bardic](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/bardic/32/3708_2.png) [@bardic](https://forum.kirupa.com/u/bardic)\
**Post date:** [February 19, 2008, 3:35pm UTC](https://forum.kirupa.com/t/php-echoed-js/252372/1 "2008-02-19T15:35:44Z")

</div>

Good day all,  
Having a little bit of a problem. What I’m trying to do is in a while loop each out some JS to create a class to handle div animation (I’m using mootools)

So here’s my code. The bolded section is the one causing me trouble.

```auto
<?php
    include "inc/conn.php";
    $page = 1;
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>Untitled Document</title>
        <script type="text/javascript" src="/inc/js/mootools-release-1.11.js"></script>
        <link rel="stylesheet" type="text/css" href="inc/css/menu.css" />
        <link rel="stylesheet" type="text/css" href="inc/css/series.css" />
    </head>
    <body>
        <div id="menu">
            <?php
                include "inc/menu.php";
            ?>
        </div>
        <div id="sub_menu">
            <a href="series.php?o=0">Series I am watching</a> | <a href="series.php?o=1">Series I have watched</a> | <a href="series.php?o=2">Series I want to watch</a>
        </div>
        <?php
            if(!isset($_GET['o']) || $_GET['o']==0){
                $q = mysql_query("select * from series where state = 0");
            }elseif($_GET['o']==1){
                $q = mysql_query("select * from series where state = 1");
            }else{
                $q = mysql_query("select * from series where state = 2");
            }
            $i=0;
            
          ** while($r = mysql_fetch_array($q)){
                $i++;
                echo "<script language=\"JavaScript\">var mySlide".$i." = new Fx.Slide('block".$i."');</script>";
                echo "<script language=\"JavaScript\">$('toggle".$i."').addEvent('click', function(e){e = new Event(e);mySlide".$i."toggle();e.stop();});</script>";
                echo "<div class='ser' id='block". $i ."' >";    
                echo "<a id='toggle".$i."' href='#'>toggle</a>";            
                echo "<h2>" . $r['name']."</h2><img src='". $r['img'] ."'/>". $r['description']. "<br/>";
                if($_GET['o']!= 2){ echo "<p class='rate'>Rating:".$r['rating']."/10</p>"; };
                echo "</div>";
            }**
        ?>
    </body>
</html>

```

Any thoughts on what I’m doing wrong?
