Search Posts

Category: mysql

Insert JSON data to database in Angularjs

Im working on a form which has a dynamic generated fields. My problem is I cant insert data from those generated fields. I tried this thread How to insert json array into mysql database but Its not working for me. I tried to populate the data when transferred to PHP but got no luck. DB Connection <?php class DbConfig { private $_host = ‘localhost’; private $_username = ‘root’; private $_password = ”; private $_database = […]

How to retrive data using angular js and which stored json format in MYSQL coloumn

I have JSON data stored in MySQL column like this, column name is payments_json_details [{“amount”:”1000″,”mop”:”Cash”,”paymentdate”:”2017-12-04 16:25″,”remarks”:”testt1″},{“amount”:”2500″,”mop”:”Cheque”,”paymentdate”:”2017-12-05″,”remarks”:”testt2″}] When we use this angular js for display purpose, iam getting data like above as it is., but i want to retrieve each values like amount, mop etc {{pdata.deliveryinfo[index].payments_json_details}} <span ng-repeat=”(key, value) in pdata.deliveryinfo[index].payments_json_details”> {{value}} </span> Iam tried this way, but there is no output, can anyone help? JSON format like this { “jobcard_id”: “33”, “jobcard_sno”: “8”, “user_id”: “140”, […]

Subtraction of Date in angularjs

I want to subtract two dates in angularjs which are getting fetched from database. The code works fine for all values except subtraction between dates fetching from database…I used PHP with MySQL can anyone tell me how to do this subtraction. Here is the code. Thanx in advance <html> <head> <script src=”angular.js”></script> <script> var app= angular.module(“myapp”,[]); app.controller(“mycontroller”,function($scope,$http){ $http.get(“select.php”).success(function(response) { $scope.names = response.data.records;}); }); </script> </head> <body ng-app=”myapp” ng-controller=”mycontroller”> <table border=1> <tr> <th>ID </th> <th>Name of […]

what return value of php that triggers error on js promise?

What values in php makes the js promice force to error function? When I turn off my sql, I want to go to err function in my service. But it keeps on going to success function. What is wrong with my code? this is the service code: operations.service(‘dbOperations’,function($http){ this.processData = function(process,dataInputs,callback){ return $http({ method:”POST”, url:”/common/functions.php”, data: { ‘process’: process, ‘data’: dataInputs } }).then(function success(res){ // callback(); console.log(res); return res.data; }, function err(response) { return “Something […]

How to make PHP change value in ionic v1?

I made some project in ionic but i have some problem to change value in ionic from php. My problem is how to change value in ionic with php if data database there are changes. I try loop in one second in ionic but it will be wasteful internet quota. Can php push to ionic when value in database changed ?. If someone have some idea please tell me it will be helpful. Thanks. Source: […]

error 401 authenticate user at login page angularjs

I am creating a simple login form with only ‘username’ and ‘password’ fields. I have this as my auth.js and it keeps showing authentication error. I am new in coding and have copied and pasted from a few of my previous projects to create my own. Please help me see where went wrong and teach me if i’m doing authenticated right. I am connected to MySQL and have one admin account there. All this time […]

Cannot insert multiple records at a time with php and angular2

I’m trying to insert multiple records from selected checkboxes to mysql db with php. What is happening is after i post and go to check the db, i find all the records inserted in one line instead of each making a unique insertion. Below is the data is post in an array [“A”,”B”,”C”,”C”,”B”,”A”,”D”,”B”,”D”,”A”,”A”,”A”,”B”,”A”,”B”,”B”,”B”,”C”,”B”,”B”,”A”,”A”,”A”,”C”,”B”,”B”,”D”,”C”,”C”,”C”,”B”,”D”,”D”,”D”,”D”,”D”,”C”,”D”,”C”,”A”,”A”,”B”,”C”,”C”,”B”,”A”,”D”,”B”,”D”,”A”,”A”,”A”,”B”,”A”,”B”,”B”,”B”,”C”,”B”,”B”,”A”,”A”,”A”,”C”,”B”,”B”,”D”,”C”,”C”,”C”,”B”,”D”,”D”,”D”,”D”,”D”,”C”,”D”,”C”,”A”,”A”,”B”,”C”,”C”,”B”,”A”,”D”,”B”,”D”,”A”,”A”,”A”,”B”,”A”,”B”,”B”,”B”,”C”,”B”,”B”,”A”,”A”,”A”,”C”,”B”,”B”,”D”,”C”,”C”,”C”,”B”,”D”,”D”,”D”,”D”,”D”,”C”,”D”,”C”,”A”,”A”,”B”,”C”,”C”,”B”,”A”,”D”,”B”,”D”,”A”,”A”,”A”,”B”,”A”,”B”,”B”,”B”,”C”,”B”,”B”,”A”,”A”,”A”,”C”,”B”,”B”,”D”,”C”,”C”,”C”,”B”,”D”,”D”,”D”,”D”,”D”,”C”,”D”,”C”,”A”,”A”,”B”,”C”,”C”,”B”,”A”,”D”,”B”,”D”,”A”,”A”,”A”,”B”,”A”,”B”,”B”,”B”,”C”,”B”,”B”,”A”,”A”,”A”,”C”,”B”,”B”,”D”,”C”,”C”,”C”,”B”,”D”,”D”,”D”,”D”,”D”,”C”,”D”,”C”,”A”,”A”,”B”,”C”,”C”,”B”,”A”,”D”,”B”,”D”,”A”,”A”,”A”,”B”,”A”,”B”,”B”,”B”,”C”,”B”,”B”,”A”,”A”,”A”,”C”,”B”,”B”,”D”,”C”,”C”,”C”,”B”,”D”,”D”,”D”,”D”,”D”,”C”,”D”,”C”,”A”,”A”,”B”,”C”,”C”,”B”,”A”,”D”,”B”,”D”,”A”,”A”,”A”,”B”,”A”,”B”,”B”,”B”,”C”,”B”,”B”,”A”,”A”,”A”,”C”,”B”,”B”,”D”,”C”,”C”,”C”,”B”,”D”,”D”,”D”,”D”,”D”,”C”,”D”,”C”,”A”,”A”,”B”,”C”,”C”,”B”,”A”,”D”,”B”,”D”,”A”,”A”,”A”,”B”,”A”,”B”,”B”,”B”,”C”,”B”,”B”,”A”,”A”,”A”,”C”,”B”,”B”,”D”,”C”,”C”,”C”,”B”,”D”,”D”,”D”,”D”,”D”,”C”,”D”,”C”,”A”,”A”,”B”,”C”,”C”,”B”,”A”,”D”,”B”,”D”,”A”,”A”,”A”,”B”,”A”,”B”,”B”,”B”,”C”,”B”,”B”,”A”,”A”,”A”,”C”,”B”,”B”,”D”,”C”,”C”,”C”,”B”,”D”,”D”,”D”,”D”,”D”,”C”,”D”,”C”,”A”,”A”,”B”,”C”,”C”,”B”,”A”,”D”,”B”,”D”,”A”,”A”,”A”,”B”,”A”,”B”,”B”,”B”,”C”,”B”,”B”,”A”,”A”,”A”,”C”,”B”,”B”,”D”,”C”,”C”,”C”,”B”,”D”,”D”,”D”,”D”,”D”,”C”,”D”,”C”,”A”,”A”,”B”,”C”,”C”,”B”,”A”,”D”,”B”,”D”,”A”,”A”,”A”,”B”,”A”,”B”,”B”,”B”,”C”,”B”,”B”,”A”,”A”,”A”,”C”,”B”,”B”,”D”,”C”,”C”,”C”,”B”,”D”,”D”,”D”,”D”,”D”,”C”,”D”,”C”,”A”,”A”,”B”,”C”,”C”,”B”,”A”,”D”,”B”,”D”,”A”,”A”,”A”,”B”,”A”,”B”,”B”,”B”,”C”,”B”,”B”,”A”,”A”,”A”,”C”,”B”,”B”,”D”,”C”,”C”,”C”,”B”,”D”,”D”,”D”,”D”,”D”,”C”,”D”,”C”,”A”,”A”,”B”,”C”,”C”,”B”,”A”,”D”,”B”,”D”,”A”,”A”,”A”,”B”,”A”,”B”,”B”,”B”,”C”,”B”,”B”,”A”,”A”,”A”,”C”,”B”,”B”,”D”,”C”,”C”,”C”,”B”,”D”,”D”,”D”,”D”,”D”,”C”,”D”,”C”,”A”] PHP <?php require_once(‘../Connections/catchapp.php’); ?> <?php $data= json_decode(file_get_contents(“php://input”)); $uanswer= mysql_real_escape_string($data->useranswer); foreach ((array) $uanswer as $item) { mysql_select_db($database_catchapp, $catchapp); $insertSQL = (“INSERT INTO user_answers […]

how to save file upload in angular to database in php

i have other form data and i want to have a file upload also this is the for file upload: <div role=”tabpanel” class=”tab-pane fade in” id=”Attachements”> <div class=”form-group”> <label class=”control-label col-sm-2″ for=”ConsultationAttachments”>Remarks :</label> <div class=”col-sm”> <div class=”input-group”> <input type=”file” name =”ConsultationAttachments” ng-model=”filesToAdd” accept=”image/*”> </div> </div> </div> </div> this is in my controller var data={ EmployeeID: $scope.EmployeeID, EmployeeName: $scope.EmployeeName, filesToAdd: $scope.filesToAdd }; $http({ method: ‘POST’, url: ‘functions/Employee.php’, headers: { ‘Content-Type’: undefined }, data: { data } […]

Fetch data using php mysql and angularJS

I using cakephp and angularJS. But I can not fetch data from controller to angularJS. My controller: $note2 = $this->Note->find(‘all’, array( ‘fields’ => ‘id, title, create_at’ )); $data_arr = array(); $i = 0; foreach($note2 as $not){ $data_arr[$i][‘id’] = $not[‘Note’][‘id’]; $data_arr[$i][‘title’] = $not[‘Note’][‘title’]; $data_arr[$i][‘create_at’] = $not[‘Note’][‘create_at’]; $i++; } echo json_encode($data_arr); My file js: var myApp = angular.module(“myModule”, []); myApp.controller(“myController”, function ($scope, $http){ $http.get(‘/thunder_note/notes/index’).then(function(result){ $scope.list_data=result; }); }); My view: <div ng-controller=”myController”> …. <tr ng-repeat=”zaa in list_data”> <td>{{zaa.id}}</td> […]

Get JSON data to angularJS module

I am trying to bind json data to angular module. Following is my code. <script> var app = angular.module(‘myApp’,[]); app.controller(‘myCtrl’,function($scope,$http){ $http.get(“list.php”).then(function(response) { $scope.myData = response.data.records; }); }); </script> <div class=”col-md-12″><!–col 1–> <ul> <li ng-repeat=”z in myData”> {{ z.Type }} </li> </ul> And my list.php file, <?php include_once(“mysql_db/db.php”); $sql = “SELECT * FROM taxitype”; $data = retrieve($sql); // This execute mysqli functions and return an array echo json_encode($data); ?> But it is now displaying list in […]

Next Page »