virgiliopontes/autowheremysql

With this package, it's easy to create visions where your users become more powerful. You give them the power to filter fields all fields in a query, without the need to create each field separately.

0.2.1 2018-06-21 03:10 UTC

This package is not auto-updated.

Last update: 2024-11-02 06:03:50 UTC


README

This package to create the where part of your MySQL queries from a simple form submission, and everything automatically.

Install

composer require virgiliopontes/autowheremysql

Examples

The Hello World example.

Go to the examples directory in the root of the repository (vendor/virgiliopontes/autowheremysql/examples).

Open the index.php with your favorite text editor and take a look at the source code.

Open the browser

Navigate to the directory where the index.php is allocated.

Exemple

http://127.0.0.1/vendor/virgiliopontes/autowheremysql/

Note: You need to replace 127.0.0.1 with the machine address where the example is

Installation

Composer

Install Composer if you don't have it.

composer require virgiliopontes/autowheremysql

Or in your composer.json file add:

{
    "require": {
		"virgiliopontes/autowheremysql": "~2",
    }
}

And the just run:

composer update

and thats it.

Using

Uses in Controller by adding use AutoWhere/AutoWhereMysql after namespace

<?php
namespace App\Controllers;

use AutoWhere\AutoWhereMysql; //<--- Here

class YourClass
{
	//...

    public function YourMethod()
    {        
        $autoWhereMysql = new AutoWhere\AutoWhereMysql();
        if(isset($_POST['campofiltro'])){
            $where = $autoWhereMysql->make_where($_POST['campofiltro'],$_POST['operador'],$_POST['valorfiltro']);
            echo $where;
        }

    }
}    

Questions?

Call me on Twitter @virgiliopontes.

License

MIT