Having problem in fetching data from database using PHP MySQL PHP

I have tried a very simple example of PHP MySQL Ajax following the example -


I created two files putting these in a same folder and uploaded it to the server.I have also checked the connection with DB from the php file. But I don't understand why the html file does not bring any data from the the database. What's wrong with that. The example i followed can be found here.

http://aiworker2.usask.ca/age/ajax.html http://aiworker2.usask.ca/age/ajax-example.php

I'm very new in AJAX and really don't understand what's going on. Any sort of help will be appreciated.

Asked By: Pow

Answer #1:

My 2 cents: First of all, try a simpler Ajax request to get yourself used to the mechanics of the thing.

All you have to do on the PHP side is echo out some data. For example, you could have your ajax open "test.php", then have "test.php" look like this:

<?php echo "working"; ?>

Then, just alert yourRequest.responseText (the response text property) and it should say "working".

Once you've got this moving smoothly, you can modify the PHP file to make a MySQL request.

Answered By: Ben
The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

# More Articles