php in javascript

Discussion in 'PHP' started by sittsait, Sep 6, 2009.

  1. #1
    This question is about using TinyMCEs ajax load. (http://tinymce.moxiecode.com/examples/example_06.php).
    How can I execute a MySQL query on line 7 to get the new content WHERE pagenumber=-1
    I cannot seem to use $pagenumber-1 in WHERE clause because it will always equal to 7-1=6 for example.

    This is the button:
    echo "<img src='images/main/previous.png' border='0' onclick='ajaxLoadprevious();'>";
    Code (php):
    And this is the script:
    <script type="text/javascript">
    function ajaxLoadprevious() {
     var ed = tinyMCE.get('content');
     ed.setProgressState(1);
     window.setTimeout(function() {
     ed.setProgressState(0);
     ed.setContent('MYSQL QUERY HERE');
    }, 1000);
    }
    </script>
    Code (php):
    Cookie, 10 hugs and a big thanks for anyone, who helps me out :banghead:
     
    sittsait, Sep 6, 2009 IP