title: Call javascript function from PHP whilst page loads
body: <p>I'm attempting to call a javascript function from a PHP loop. The call passes an id from the PHP loop and then is supposed to set a class based on whether it finds the id in a cookie. At the moment I am simply getting:</p>
  
  <blockquote>
    <p>ReferenceError: getFaveClass() is not defined</p>
  </blockquote>
  
  <p>My code is the following -</p>
  
  <pre><code>?&gt;
  &lt;script&gt;getFaveClass(&lt;?php echo $row-&gt;id; ?&gt;);&lt;/script&gt;
  &lt;?php
  </code></pre>
  
  <p>Is there something I am missing or a better way of doing this?</p>