Friday 30 August 2019

Mysql Tutorial | Give Priority To Specific Values In Select Query Using ...



Query Examples









1) SELECT * FROM
`employee` order by FIELD(name,"steve rogers","loki")
desc
2) SELECT * FROM
`employee` order by FIELD(salary, id IN (select id from employee
where salary > 300 and salary < 800))








Hello guys.
This tutorial will
be about how to give more priority to specific values in SELECT query
of mysql database server without where clause. And how to fix the
error “subquery returns more than 1 row”. In order by field. For
example, what if you want employee should have more priority where
the salary between 300 and 700 then the rest will be displayed.
The application of
using this will be, getting data which are more related to topic like
google search.
As you can see, i
have one employee table, so instead of using where clause, I am going
to use order by Field, the FIELD is a function, the first argument
will be the calumn name that you want to be ordered, then in other
arguments, you can specify which values you specifically want, in my
case its steve and loki. Make sure to type “DESC” to make sure
that they come on top of list.
But what if you
don’t know how many data should have more priority or if the list
is too large, in that case, we shall use the subquery.
In my case, I want
to give prioritize by salary, so first argument will be salary, and
in second argument, in subquery I am going to call primary key, which
is ID, then apply the condition of salary between 300 and 800.
As you can see, it
is giving me the error that “it is returning more than one row ”
which is obvious. So to fix it, just apply condition “id in”
before subquery.
In result, you can
see that all the data is coming, but employee between salary 300 and
700 have more priority.
Thank you for
watching, dont forget to like share and subscribe.

Saturday 24 August 2019

A Trip To Hyderabad & Mallikarjuna Jyotirlinga | Telangana And Andhra Pr...



Please avoid or flag spams/hateful comments. And do not spam. Enjoy :)

Subscribe my Channel:-
http://www.youtube.com/user/SanketRooney?sub_confirmation=1

Facebook Page:-
https://www.facebook.com/UnpossibleNS

Twitter Account:-
https://twitter.com/UnpossiblePOG

Blog :-
https://unpossiblepog.blogspot.in/

The trip was a visit to our 4th jyotirlinga out of the 12. In the morning, we thought everything will go smoothly but suddenly we got a message the train from mumbai was cancelled and now we had to go to PUNE to catch that train. So somehow made it vary early. Sadly some people who were already in train didn't know that train will not go to mumbai. We hoped that they reached home safely. The train was empty with few people. In the morning, we realized that we are already outside Maharashtra state which was TELANGANA. After we reached to hyderabad, we quickly catch the BUS to andhra pradesh. Our destination was mallikarjuna Srisailam. Between that BUS journey, we found that there is one DAM near the road. We decided to stop there when we return home.

Thursday 15 August 2019

Sublime Text 3 Bug | Solution & Avoidance Of Not Highlighting PHP Syntax











Hello guys, this is
unpossible pog here.
Today, I shall talk
about the PHP code not getting highlighted while using SUBLIME text.
I am using the
SUBLIME version 3.2.1.
As you can see, the
PHP code is not highlighted means it is in plain white color.
So I shall tell you
the solution as well as how to avoid PHP not getting highlighted.
The solution is vary
easy.
You just have to
close it and reopen it. Thats it and your PHP code will be
highlighted.
Although how to
avoid it is also vary easy.
Usually when you
copy-paste the code, it creates a problem as you can see.
So to avoid that,
first create empty “untitled” file, paste the code, then save it.
With that, sublime
recognizes PHP code and highlights it automatically.
Thank you for
watching, dont forget to like share and subscribe.

Sunday 4 August 2019

AngularJS Tutorial | Easiest Way To Upload Multiple Files



index.php



<!DOCTYPE html>  

 <html>  

      <head>  

           <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

           <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.7.8/angular.min.js"></script>

      </head>  

      <body style="padding-top: 30px;">  

      <center><h2>Angular JS 1.7 <br> <b>Easiest Way To Upload Multiple Files</b></h2></center>

           <div style="padding-top: 30px;" class="container" ng-app="myapp" ng-controller="myController" ng-init="select()">  

                <div class="col-md-12">  

                     <input type="file" file-input="files" class="form-control" multiple/>  

                </div>  

                <div class="col-md-12" style="padding-top: 10px;">  

                     <button class="btn btn-success form-control" ng-click="upload()">Upload</button>  

                </div>  

                 

           </div>  

      </body>  

 </html>  

 <script>  

 var app = angular.module("myapp", []);  

 app.directive("fileInput", function($parse){  

      return{  

           link: function($scope, element, attrs){  

                element.on("change", function(event){  

                     var files = event.target.files;  

                     $parse(attrs.fileInput).assign($scope, element[0].files);  

                     $scope.$apply();  

                });  

           }  

      }  

 });  

 app.controller("myController", function($scope, $http){  

      $scope.upload = function(){  

           var form_data = new FormData();  

           var count=0;

           angular.forEach($scope.files, function(file){  

                form_data.append('file'+count, file);  

                count++;

           }); 

           form_data.append('count_of_files', count);   

           $http.post('upload_file.php', form_data,

           {  

                transformRequest: angular.identity,  

                headers: {'Content-Type': undefined,'Process-Data': false}  

           }).then(function(response){  

                alert(response.data);  

           });  

      }  

 });  

 </script> 
upload_file.php


<?php

for($i=0;$i<intval($_POST['count_of_files']);$i++)

{

if($_FILES['file'.$i]['name']!="" )

{

move_uploaded_file($_FILES['file'.$i]['tmp_name'], ''.$_FILES['file'.$i]['name']) or die ('cannot upload');   

}

}



?>








Hello guys, this is
unpossible pog here.
Today, I shall show
you the easiest way to upload mutiple files using ANGULAR JS 1.7 &
PHP.
Before we that, if
you are linux user, then make sure that you have the permission to
upload anything.
Now if you see the
current code, it lets you upload the file one at a time. And we are
changing it to upload multiple files.
I created one PHP
file called “upload_file.php” to perform upload operation.
The strategy is to
give each file a specific name.
So I shall create a
count variable, within the loop. I shall increase it by one.
Then I shall create
the “POST VARIABLE NAME” called “count_of_files” and append
it in form.
In php code, I shall
echo it.
Make sure to add
multiple attribute on file input type.
Now it will show me
the count of files selected for uploading.
Here we go.
Now we have to give
each file a specific name, so append count number after each file.
With that, each file
will have it’s own unique name.
In PHP code, we
create a for loop, and limit it upto that variable.
Now, we have to call
each file by its unique name. So, append variable I after each file.
Lets test, we shall
select 3 files, and click on “UPLOAD”. And those files are
uploaded in folder.
The code is in the
description.
Thank you for
watching, dont forget to like share and subscribe.