Passing data to a PHP script

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sebarry
    New Member
    • Jul 2007
    • 69

    Passing data to a PHP script

    Hi,

    I have the following actionscript that invokes a PHP script.

    Code:
    var articlesToRetrieve = 5;
    var currentIndex = 0;
    
    varSenderTitles = new LoadVars();
    varReceiverTitles = new LoadVars();
    
    var limit = currentIndex + "," + articlesToRetrieve;
    var url = "http://www.bemod.co.uk/scripts/GetNewsArticles.php?limit=" + limit;
    
    //Send request.
    varSenderTitles.sendAndLoad(url, varReceiverTitles, "GET");
    
    //Retrieve the thread text.
    varReceiverTitles.onLoad = function() 
    {
         .....
    }
    The PHP script is:

    Code:
    $sql = "SELECT news_id, title FROM news ORDER BY title DESC LIMIT " . $_GET['limit'];
    
    $result = $con->sqlExecute($sql);
    
    while($row = mysql_fetch_array($result, MYSQL_ASSOC))
    {
         $articles .= $row['news_id'] . '~' . $row['title'] . '|';
    }
    
    $articles = urlencode($articles);
    The PHP script works fine when I replace $_GET['limit'] with a hardcoded value. When I print out what is returned into varReceiverTitl es it is undefined.

    Any ideas?

    Sean
Working...