AJAX, SQL and PHP question

    Date: 04/05/06 (PHP Community)    Keywords: php, xml, database, asp, sql, java

    Hi guys,
    I was just fooling around with AJAX for the first time and it's working fine so far, but of course some problems are around.

    My question is, is there some possibility to insert PHP code in Javascript?
    I have my JavaScript file, and now I need to tell it somehow which ID to select from the database.

    function showFan(str) {
    var url="getFans.php?id=" + Math.random() + "&q=" + str
    xmlHttp=GetXmlHttpObject(stateChanged)
    xmlHttp.open("GET", url , true)
    xmlHttp.send(null)
    }

    The second line is the one that bothers me. There should be the SQL table variable after the id=, like this; getFans.php?id=$country. The +Math.random() stuff is from the tutorial, no idea what it does, and the rest of the line is also from the tutorial, they used ASP there but I have no clue about asp. So can anyone help me out with and and tell me what PHP code I need to have in my getFans.php in order to make this work? My getFans.php is just a file with the usual database connections and printing stuff, nothing else.

    Thanks is advance :)

    Source: http://community.livejournal.com/php/434515.html

« Sending mail || KSES Configuration »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home