简体   繁体   中英

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 -

http://www.tutorialspoint.com/ajax/ajax_in_action.htm

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM