What’s the notation to redefine a php variable as a javascript variable?
<?php
include 'connect_to_mysql.php';
$results = mysql_query("SELECT * FROM plan WHERE TIMESTAMP(NOW()) < TIMESTAMP(end)") or die(mysql_error());
$phpVar = mysql_num_rows($results);
echo '<script type="text/javascript">';
echo 'var x = ???????????';
echo 'document.write("<p>" + x + "</p>")';
echo '</script>';
?>
you need to put either a semi-colon or new line char (preferably a semi-colon) at the end of your js generated by php in order to separate the individual js statements.
the semi-colon at the end is just the normal mandatory semicolon at the end of the php echo statement. It doesn’t output a semi-colon at the end of the js code that the echo statement generates. Your echo statement needs to output a semi-colon at the end of the js statement it generates.