Jump to content


Photo

php query


  • Please log in to reply
4 replies to this topic

#1 newman

newman
  • Members
  • PipPip
  • Member
  • 28 posts

Posted 11 March 2006 - 09:00 AM

hi all .
how can i query my database without reloading the page . i read some tutorials about PHP and AJAX . but i didnot understand the solution .

#2 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,017 posts

Posted 11 March 2006 - 09:22 AM

Does [a href=\"http://members.aol.com/barryaandrew/xmlhttp/article.html\" target=\"_blank\"]this[/a] help?
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#3 newman

newman
  • Members
  • PipPip
  • Member
  • 28 posts

Posted 10 April 2006 - 01:24 PM

thank you so much for your useful tutorial , but when I use the JS code blow i get a javascript error : unepected indetifier


function handleMessages (url, resultID) {
  var obj;
  xmlhttp.open("GET", url, true);
  xmlhttp. {
       if (xmlhttp.readyState==4) {
            obj = document.getElementById(resultID);
            obj.innerHTML = xmlhttp.responseText;
       }
  }
 xmlhttp.send();
 return 0;
}



what's the problem ?

#4 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,017 posts

Posted 10 April 2006 - 06:42 PM

Is it because part of the code is missing?

function handleMessages (url, resultID) {
  var obj;
  xmlhttp.open("GET", url, true);
  xmlhttp.onreadystatechange=function() {        // <--  misssing code
       if (xmlhttp.readyState==4) {
            obj = document.getElementById(resultID);
            obj.innerHTML = xmlhttp.responseText;
       }
  }
 xmlhttp.send();
 return 0;
}

If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#5 newman

newman
  • Members
  • PipPip
  • Member
  • 28 posts

Posted 10 April 2006 - 10:22 PM

thanks a million . it's functioning perfectly.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users