Datafetcher.php

Datafetcher helps you to get data from your table easily reducing your time in creation of separate files to get data from database.

  • Why do we write different php files to get data from different tables of our mysql database. We can save our disk space by reducing all your php files to get data from database. Here i introduce Datafetcher.php which will get data from table seamlessly and generate output in Json format for you.


    How does datafetcher.php work ?
    1. It fetches all columns in your table.
    2. Then it displays all rows in table by formatting it into json string which can be used by your application.



    How to use Datafetcher.php ?
    Steps :
    1. Just supply your database details into Datafetcher.php and copy Datafetcher.php into your xampp project.
    2. Edit database details code to point to your database.
    3. Now Datafetcher is ready to run.
    4. Now go to your Chrome browser in url section type following :
    http://localhost/YourProjectName/Datafetcher.php?table=YourTableName

    Note:
    Replace YourTableName with any table name in your database.
    Replace YourProjectName with your project name or folder name.
    5. You will get all data in json format.

    How to use Datafetcher.php with Condition ?
    Consider you want to display records based on condition.
    Note : only one condition is allowed for now.

    For example :
    If you want to display records having id =5 or Name=ankit, You can do this by supplying condition to Datafetcher.php.

    How to supply condition ?

    Steps :

    1. Just type following :
    http://localhost/YourProjectName/Datafetcher.php?table=YourTableName & KeyName=YourKeyName & KeyValue = YourKeyValue

    For Example :
    To fetch row with Username 'Ankit' i would write url as follows :

    http://localhost/YourProjectName/Datafetcher.php?table=YourTableName&KeyName=Username& KeyValue=Ankit

    Thats it.
    For more information Visit : SpartaCoder:Datafetcher.php

    Subscribe in a reader