Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Apr 5, 2023. It is now read-only.

geekbrother/ngMySQL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

ngMysql

Mysql PHP Binding for AngularJS.

Using JSON from AngularJS POST requests to update , delete or show elements from MySQL table.

Create MySQL connection binding:

require('ngmysql.php');

$ngmysql = new mysqlbinder(
	$mysql_host,
	$mysql_user,
	$mysql_password, 
	$mysql_db, 
	"table"
	);
$mysq->table="new table"; // Optional MySQL table change
$ngmysql->debug = true;

Example of SHOW table records with id,added,name,date columns and order by added DESC:

function ShowOrders($ngmysql) {
	$ngmysql->table='table';
	$out = $ngmysql->select_json('','id,added,name,date','added DESC');
	echo $out;
}

Example of UPDATE table records from POST request JSON from AngularJS where KEY for UPDATE is id and additional SQL parameters for UPDATE is status=2:

if (!$ngmysql->update_json('id','','','status=2') ){
  echo 'Error durng update';
}

About

PHP+Mysql binding library for AngularJS

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages