Search Posts

Category: php

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 […]

filtering in an ng-repeat from JSON response

I’ve got a question about filtering within a ng-repeat. But this isn’t a simple question since I’m not really having a problem that needs a solution. In this case, i’m looking for the best possible answer that doesn’t require a lot of code but still does the trick as to how I want it to. It will become more clear in my description. a short introduction: So I’m currently working on a shopping application. The […]

Angular ng-repeat not showing data on laravel?

The console shows that the posts were retrieved successfully, the backend works fine without the angular compatibility. and its supposed to retrieve post data. angular.js:12701 XHR finished loading: GET ““. however it shows 5 empty divs like the following main.js $http.get(‘/auth/posts’).then(function(data){ $scope.myposts = data; }); PostController public function getPosts() { $posts = Post::all(); return json_encode($posts); } Route Route::get(‘auth/posts’, ‘[email protected]’); the html file <div id=”mypost” class=”col-md-8 panel-default” ng-repeat=”post in myposts”> <div id=”eli-style-heading” class=”panel-heading”><% post.title %></div> <div […]

Select specific values from json_decode in php

I’ve stumbled on a problem that i think is a bit strange since i’ve followed other examples to the exact code but i still didn’t get the same result. Short summary I’m developing a shopping application and i’m using a session for the cart. Since i want to have the possibility to remove items from the cart i am using some levels inside the JSON object of the session. Cart summary The cart is created […]

Angular materials autocomplete

I am trying to autocomplete my form using Angular materials. Here, I want to autocomplete the input form. For the suggestions to be displayed, I want to display the names of the stock names and symbols. I am getting the stock data from the following API: Whenever I type a new alphabet, the new text is taken and the new text is passed to the searchTextChange function in my code. The searchTextChange function makes […]

How can i use angularjs http post response as a condition for manipulating the dom

Hi guys I would like to think this question I have is not new here but I have looked and found nothing that can clearly help me, I am new to angular My scenario I am posting data to a php api and that is working fine and I am getting the 200 ok response , but I have one issue I get two different response depending on the data posted if the data being […]

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 } […]

AngularJS works on one domain, but not another

I have been developing an AngularJS App at one domain, say, then copying it over to another, say I’ve done this in stages once I have an element working. All has been going well, but as the application has got larger, I’ve found that things don’t always work on the school domain. Below is one of many functions which ‘get’ data from data-process.php, all others of which work on both sites. I have […]

Next Page »