Where is the probem in this code (javascript)?
- by user318068
Hi
I have a problem in my code.
can anybody help me ...
<html>
    <body>
    <script type="text/javascript">
        <?php
        $conn = mysql_connect("localhost","root");
        mysql_select_db("tr", $conn); 
        $q = mysql_query("SELECT message FROM messages WHERE to_viewed = '0' ");
        if (mysql_num_rows($q)) {
            require('pm.php');
            ?>
            var answer = confirm("you have new message ");
            <?php
        }
        ?>
        if (answer) {
            window.location = "http:>>>/";
        } else {
        }
    //-->
    </script>
</body>
</html>
Thanks ....
The error that appears in my code is that the confirm is not working if I open my page (no output)