After visiting the main place "Mallikarjuna Jyotirlinga", we packed our bags, completely exhausted and went for our first destination to go home, that is, Hyderabad. One of our friend have some friends who live in Hyderabad. We met them, and they helped us exploring the city. The main thing that I was excited about is "Chicken Biryani". After that, we went to hotel, spent night and next day, we catch train. We had fun dancing in train as we always do. Then we reach PUNE and then catch the bus to reach MUMBAI.
In this tutorial, we
shall discuss how to navigate to each week, how to set range of
weekdays like from monday to sunday, or sunday to saturday, or any
from and to days you want ,and also how to get days of each week.
For example, let say
the current day is 15 sept 2019, so the range will always be of 7
days. But we get days from wednesday to tuesday.
We can also navigate
to next weeks or previous weeks and get dates between them.
So lets get started.
We shall build code
from the scratch.
First we shall get today’s date and day.
Next, I am going to
add refresh link, it’s purpose will be revealed later.
New we shall find
the week-day count using this code.
By using this, we
shall get first day and last of every week.
For first day, we
are using “minus” symbol in strtotime function.
And for last day of
week, we shll use plus sign.
Let get, which day
it is.
Now we shall find
all days between two days by using for loop.
Let make it on
center.
Now we shall add
week navigation, so fot that we have to find two numbers, for next
week and last week.
For previous week,
there will be + 7.
In href, we shall
make a variable called week count. And assign value for previous and
next week.
Now, even when
clicked on link, it doesn’t do anything.
So we have to
overwrite the $week value.
Let test
it.
Acutally I made a mistake in a code.
Ok, so you just have
to add + instead of minus at “Week first date”.
Lets refresh and
test, as you can see, we are hopping on each week.
But what if, we want
start date from monday. So change, like this and as you can see, the
result is coming correctly.
You can select from
day to any day like monday, tuesday wednesday.
So actually, the
main strategy is those numbers, we have to make sure that the
addition between them should be 6.
Let change current date to
17 september.
So no matter what
your current date will be, the code will display every day of every
previous and next weeks.
The code’s link is
in the description.
Thank you for
watching, dont forget to like share and subscribe.
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.
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.