Wednesday, 19 April 2023

How can I make my web API secure?

 There are several steps you can take to make your web API secure:

Use HTTPS: HTTPS encrypts all communication between the client and server, making it difficult for attackers to intercept and tamper with data.

Authenticate users: Use a secure authentication mechanism to ensure that only authorized users can access your API. This can include methods such as OAuth, JWT, or API keys.

Authorize requests: Once a user is authenticated, make sure they only have access to the resources and actions they are authorized to access. Implement role-based access control (RBAC) or attribute-based access control (ABAC) to restrict access to sensitive data.

Validate inputs: Always validate inputs from clients to prevent injection attacks such as SQL injection, XSS, or CSRF.

Limit API requests: Implement rate limiting and request throttling to prevent brute force attacks, DDoS attacks, and other types of abuse.

Encrypt sensitive data: Use encryption to protect sensitive data such as passwords, credit card numbers, and other personally identifiable information (PII).

Monitor API traffic: Monitor your API traffic to detect and respond to suspicious activity or attacks.

Keep API up-to-date: Keep your API up-to-date with the latest security patches and updates to prevent vulnerabilities from being exploited.

By following these steps, you can significantly reduce the risk of security vulnerabilities in your web API.

Sunday, 9 April 2023

What is difference between @Html.Partial() and @Html.RenderPartial() in asp.net MVC C#

Both @Html.Partial() and @Html.RenderPartial() are used to render a partial view in an ASP.NET MVC application, but they differ in how they handle the HTML output.

@Html.Partial() returns a string containing the HTML markup of the partial view, which can then be included as part of the parent view using the Razor syntax. The returned string can be assigned to a variable or passed as a parameter to a method or helper.

Example usage of @Html.Partial():

@Html.Partial("_PartialViewName", model)

@Html.RenderPartial(), on the other hand, directly writes the HTML output of the partial view to the response stream. It does not return any value, so it cannot be assigned to a variable or passed as a parameter to a method or helper.

Example usage of @Html.RenderPartial():

@{ Html.RenderPartial("_PartialViewName", model); }

Notice that we are enclosing Html.RenderPartial() method inside @{ } code block as it doesn't return any value, it just directly writes the HTML output to the response stream.

In general, @Html.RenderPartial() is more efficient than @Html.Partial() because it directly writes the output to the response stream, while @Html.Partial() creates a string that must be returned and then rendered. However, @Html.Partial() is more flexible as it can be assigned to a variable or passed as a parameter to a method or helper.

Another Detail with Code

Suppose we have a ParentView.cshtml view that needs to render a partial view named ChildView.cshtml. The ChildView.cshtml will display some basic information about a product.

Here's how we can use @Html.Partial() to render the ChildView.cshtml as part of the ParentView.cshtml:

ParentView.cshtml File

<div>

    <h2>Parent View</h2>

    @Html.Partial("_ChildView", Model.Product)

</div>

In the example above, the @Html.Partial() method is used to render the _ChildView.cshtml partial view and pass in the Product model as the parameter.

Here's how we can use @Html.RenderPartial() to render the ChildView.cshtml as part of the ParentView.cshtml:

 ParentView.cshtml File

<div>

    <h2>Parent View</h2>

    @{ Html.RenderPartial("_ChildView", Model.Product); }

</div>

In the example above, the @Html.RenderPartial() method is used to render the _ChildView.cshtml partial view and pass in the Product model as the parameter.

Notice that we are enclosing Html.RenderPartial() method inside @{ } code block as it doesn't return any value, it just directly writes the HTML output to the response stream.

Both @Html.Partial() and @Html.RenderPartial() methods can be used to achieve the same result, but @Html.RenderPartial() is more efficient as it directly writes to the response stream without creating an intermediate string, while @Html.Partial() returns a string that needs to be included in the parent view. However, @Html.Partial() is more flexible as it can be assigned to a variable or passed as a parameter to a method or helper.

@Html.Partial() returns a string containing the HTML markup of the partial view, which can then be included as part of the parent view using the Razor syntax. The returned string can be assigned to a variable or passed as a parameter to a method or helper.

Sure, here's an example of how @Html.Partial() can be used to render a partial view and assign the returned HTML markup to a variable:

Suppose we have a partial view named _ProductList.cshtml that displays a list of products. We want to render this partial view inside a ParentView.cshtml view and store the returned HTML markup in a variable named productListHTML. Here's how we can do that:

 ParentView.cshtml File

<div>

    <h2>Parent View</h2>

    @{

        var productListHTML = Html.Partial("_ProductList", Model.Products).ToString();

    }

    <div>

        @Html.Raw(productListHTML)

    </div>

</div>

In the example above, we're using Html.Partial("_ProductList", Model.Products) to render the _ProductList.cshtml partial view and passing in the Products model as the parameter. We're then calling the ToString() method on the returned string to convert it to a string and store it in the productListHTML variable.

Finally, we're using the @Html.Raw() method to output the productListHTML variable as raw HTML. This is necessary because the Html.Partial() method returns an encoded string, so we need to use Html.Raw() to prevent the encoding from being displayed on the page.

By assigning the HTML markup returned by @Html.Partial() to a variable, we can manipulate and use the markup as needed in the parent view or pass it as a parameter to a method or helper.

Friday, 7 April 2023

Automapper Reverse Mapping: Mapping Objects in Both Directions

AutoMapper is a popular object mapping tool used in .NET applications. It simplifies the process of mapping one object to another by automatically copying properties with matching names and types. Reverse mapping with AutoMapper allows you to create mappings in both directions, from the source object to the destination object and vice versa.

Let's take an example of a simple class Person and its corresponding PersonDto class, which we want to map to each other using AutoMapper.

public class Person

{

    public int Id { get; set; }

    public string FirstName { get; set; }

    public string LastName { get; set; }

    public int Age { get; set; }

}


public class PersonDto

{

    public int Id { get; set; }

    public string FullName { get; set; }

    public int Age { get; set; }

}

Now let's create a mapping from Person to PersonDto:

var config = new MapperConfiguration(cfg =>

{

    cfg.CreateMap<Person, PersonDto>()

        .ForMember(dest => dest.FullName, opt => opt.MapFrom(src => src.FirstName + " " + src.LastName))

        .ReverseMap()

        .ForMember(dest => dest.FirstName, opt => opt.MapFrom(src => src.FullName.Split(' ')[0]))

        .ForMember(dest => dest.LastName, opt => opt.MapFrom(src => src.FullName.Split(' ')[1]));

});


IMapper mapper = config.CreateMapper();


var person = new Person { Id = 1, FirstName = "John", LastName = "Doe", Age = 30 };

var personDto = mapper.Map<PersonDto>(person);


var personDto2 = new PersonDto { Id = 2, FullName = "Jane Smith", Age = 25 };

var person2 = mapper.Map<Person>(personDto2);


In the above code, we first create a mapping from Person to PersonDto and then use the .ReverseMap() method to create a reverse mapping from PersonDto to Person without having to define it explicitly.

With the .ReverseMap() method, we can then use the mapper.Map method to map Person and PersonDto instances in both directions, as shown in the example above.

Thursday, 6 April 2023

Strategies for Wealth Creation

 Wealth creation is a topic that is of great interest to many people, and for good reason. It is the process of building financial assets and achieving financial independence. Wealth creation involves a combination of earning income, saving, investing, and managing money effectively. In this blog post, we will explore some strategies for wealth creation that can help you achieve your financial goals.

Set financial goals

The first step in creating wealth is to set clear financial goals. This involves defining your long-term and short-term financial objectives. Setting financial goals can help you create a roadmap for achieving financial independence. To set effective financial goals, make sure they are specific, measurable, achievable, relevant, and time-bound.

Increase your income

Increasing your income is an important step in wealth creation. This can be achieved by asking for a raise at work, starting a side business, or acquiring new skills that can lead to a higher-paying job. The more income you earn, the more money you can save and invest.

Save and invest

Saving and investing are critical components of wealth creation. To save effectively, you must develop and stick to a budget. This involves tracking your expenses and finding ways to reduce unnecessary spending. Once you have saved some money, you can start investing it. Investing can help you grow your wealth over time. Some investment options include stocks, bonds, mutual funds, real estate, and exchange-traded funds (ETFs).

Manage debt

Managing debt is another important aspect of wealth creation. Debt can be a significant obstacle to building wealth, so it is essential to keep it under control. Make sure you pay off high-interest debt first, such as credit card debt. Consider consolidating your debt with a low-interest personal loan or a balance transfer credit card.

Create multiple streams of income

Creating multiple streams of income can help you accelerate your wealth creation journey. This can involve starting a side business, investing in rental properties, or earning passive income through investments. The more income streams you have, the more money you can earn and save.

Seek professional advice

Seeking professional advice can help you make informed financial decisions. Consider working with a financial advisor who can help you create a personalized wealth creation plan. A financial advisor can also help you identify potential risks and make adjustments to your plan as needed.

In conclusion, wealth creation is a process that requires a combination of earning income, saving, investing, and managing money effectively. By setting clear financial goals, increasing your income, saving and investing, managing debt, creating multiple streams of income, and seeking professional advice, you can build wealth over time and achieve financial independence. Remember that wealth creation is a journey, so be patient and stay focused on your goals.

Tuesday, 4 April 2023

Top Restaurants in Lahore for Food Lovers

 Lahore is a city of vibrant culture, architecture, and cuisine. The city offers a range of culinary experiences, from traditional street food to fine dining. In this article, we have put together a list of the best restaurants in Lahore that will tantalize your taste buds and leave you wanting more.

Andaaz Restaurant

Located in the heart of Lahore, Andaaz Restaurant is a hidden gem that offers authentic Pakistani cuisine. The restaurant has a traditional ambiance, and the service is exceptional. Their Chicken Handi and Mutton Karahi are a must-try. They also have a variety of vegetarian dishes on their menu.

Website: https://andaazrestaurant.com/

Butt Karahi

Butt Karahi is a well-known restaurant in Lahore that is famous for its Karahi. Located in the old city, Butt Karahi is a must-visit restaurant for all food lovers. Their Karahi is cooked to perfection and is rich in flavor. The restaurant has a cozy and traditional ambiance that will make you feel right at home.

Website: http://buttkarahi.com.pk/

Salt n Pepper

Salt n Pepper is a well-known restaurant chain in Pakistan. Their Lahore branch is located in Gulberg, and it offers a fine dining experience. The menu at Salt n Pepper is a fusion of Pakistani and Continental cuisine. Their Grilled Chicken and Steaks are a must-try. The restaurant has a sophisticated ambiance, and the service is excellent.

Website: http://saltnpepper.com.pk/

Monal Restaurant

Monal Restaurant is a famous fine dining restaurant in Lahore located on the outskirts of the city. The restaurant offers a beautiful view of the city and serves a variety of Pakistani and Continental cuisine. Their Lahori Fish, Mutton Chops, and Chicken Handi are highly recommended. The restaurant has a luxurious ambiance, and the service is impeccable.

Website: https://lahore.themonal.com/

Conclusion

Lahore's culinary scene offers a diverse range of flavors that will leave you craving for more. The restaurants we have mentioned in this article are some of the best in Lahore and offer an authentic culinary experience. From traditional Pakistani cuisine to fusion dishes, these restaurants cater to a wide range of tastes. So, the next time you're in Lahore, be sure to visit these restaurants and savor the delicious food that they have to offer.

I hope this article helps you in writing your blog post. Let me know if you need any further assistance.

Format C# code in Visual Studio

                        There are a few ways to format C# code in Visual Studio:

Keyboard shortcut: You can use the keyboard shortcut "Ctrl + K, Ctrl + D" to format the entire document or the currently selected code in Visual Studio.

Context menu: You can also right-click on the code editor and select "Format Document" or "Format Selection" from the context menu.

Menu bar: You can navigate to the "Edit" menu, select "Advanced", and then choose "Format Document" or "Format Selection".

Code cleanup: You can use the "Code Cleanup" feature in Visual Studio, which not only formats your code but also applies other code style preferences you have set. To access it, go to "Tools" > "Code Cleanup" and choose the desired code style configuration.

Extensions: There are several extensions available in the Visual Studio Marketplace that can help you format your code. One popular extension is "CodeMaid", which provides many code cleanup and formatting options.


Regardless of the method you choose, it's important to ensure that your code is consistently formatted and adheres to a defined coding style to make it more readable and maintainable. 

Please note that these options may not be available in all versions of Visual Studio or with all configurations. If neither of these options work for you, you may need to use an extension or modify your Visual Studio settings.

Wednesday, 10 August 2022

 Job:
I need an expert and experienced web designer to help me with my website. We would be creating our own template, and covering every aspect of the website, home page, log in, personal questions, menu, food etc... This is a nutrition website so design is very important for this big business in order to reach the maximum number of users.

Wednesday, 22 December 2021

Software houses in lahore Pakistan

Systems Limited
 
Contour Software
 
Allzone Technologies
 
NETSOL Technologies
 
Northbay Solutions
 
 Xavor 
 
Afiniti
 
Confiz
 
Nextbridge
 
i2cinc
 
DatumSquare IT Services
 
10pearls
 
PureLogics
 
BrainX Technologies

InvoZone

SigmaTec
http://www.sigmatec.com.pk/careers

Wadic
 










Best .Net websites and tutorial links for beginners and professionals.

Videos Links:

kudvenkat:

https://www.youtube.com/c/Csharp-video-tutorialsBlogspot/playlists

 IAmTimCorey:

https://www.youtube.com/user/IAmTimCorey/playlists 

Questpond:
https://www.youtube.com/c/questpondvideos/playlists
 
freeCodeCamp.org:
https://www.youtube.com/c/Freecodecamp/playlists 
 
Programming with Mosh:
https://www.youtube.com/c/programmingwithmosh/playlists 
 
 Les Jackson:
 https://www.youtube.com/c/binarythistle/playlists
 
 
Websites Links
  1. https://csharp-video-tutorials.blogspot.com/p/free-aspnet-video-tutorial.html

  2. https://dotnettutorials.net/

  3. https://dotnet.microsoft.com/en-us/learn 

  4. https://www.javatpoint.com/net-framework

  5. https://www.tutorialsteacher.com/core

  6. https://www.dotnettricks.com/learn/aspnet

  7. https://www.c-sharpcorner.com/csharp-tutorials

  8. https://www.guru99.com/asp-net-tutorial.html

  9. https://www.tutorialspoint.com/asp.net/index.htm 

     

    If you know any best .Net websites or tutorials links which is not mentioned in the above list then please post in comments. We will definitely add in our list.
 
 
 
 
 

Friday, 21 June 2019

Waqas Ali (List of Pojects)

Projects:

Student Portal:

Following are the modules which I developed in Student Portal
 Student Change Major Module
 Grade Entry Module
 Student Attendance Module
 Students Upload documents Module
 Colleges Publications modules.
 Student E-services
 College and Ministry Finance Audit system

Following are the reports which I developed using crystal reports
 Student Transcript
 Student Class List
 Student Absent Percentage
 Instructor Time Table
 Student Time Table
 Student Attendance Report
 Students Info in each semester
 Students Info in each Cohort
 Students Statistics
 Reports for administration department

 Reports for the HR department

Technologies:( Oracle, Asp.net, C#, SQL SERVER, HTML, CSS, JAVASCRIPT, JQUERY, and
Crystal Report, Bootstrap, Entity Framework, MVP architecture andTeam Foundation Server).

Government Colleges Finance and Audit System:
In this system, colleges can record their annual budget and expensive and the Ministry can follow and
process the whole scenario.
Technologies:( Asp.net, C#, SQL Server, Entity Framework, HTML, CSS, JAVASCRIPT,
JQUERY, Crystal Report and Team Foundation Server).

Developed Online student enrolls system:
This project is linked with Higher education admission center (HEAC). Students can register their
self on the time of registration and government colleges staff process and follow their request
through the system.
Languages :(LINKED SERVER ,Oracle, Asp.net, C#, SQL SERVER, HTML, CSS, JAVASCRIPT,
JQUERY, Crystal Report, Bootstrap and Team Foundation Server ).
Integrate Oracle and MS SQL SERVER through LINKED SERVER

Developed a complete system of students’ online services:
In that system, first students will registered and send their request to the registration department and
after that registration department follows and process request through the system.
Link: http://eservice.cas.edu.om
Technologies:( Oracle, Asp.net, C#, SQL SERVER, HTML, CSS, JAVASCRIPT, JQUERY,
Crystal Report, Bootstrap and Team Foundation Server).


Government college’s websites and Recruitment systems.
Responsible for support, maintaining enhancement of the already developed Government College’s websites and Recruitment systems.
Developed Roles permission full modules for Government College’s website.

Following is a links
  • https://recruit.cas.edu.om/index.aspx?ReturnUrl=%2f
  • https://rustaq.cas.edu.om/
  • https://salalah.cas.edu.om/
  • https://nizwa.cas.edu.om/
  • https://sohar.cas.edu.om/
  • https://sur.cas.edu.om/
  • https://sohar.cas.edu.om/


Technologies:( Asp.net, C#, SQL Server, Oracle, HTML, CSS, JAVASCRIPT, JQUERY, Crystal Report and Team Foundation Server).

Quality Management System:
Worked on some modules in the Quality Management System.
Technologies: (Asp.net, C#, MVC, Entity Framework, Bootstrap ,HTML,CSS,JQUERY and Team Foundation Server).

Coffee Shop Management Webservices (Freelance Project)
Developed small coffee shop management system web services
Technologies: (Web API, C#, Entity Framework, swagger.io, SQL SERVER).

Developed reports for US-based company.
 Developing Interface screens of Reporting.
 Analyzing data and writing Stored Procedures, Stored functions, Queries and handle
 A complex scenario in reporting back end. Handle complex scenario in reporting front end.
Technologies: (HIGH CHARTS, PHP, HTML, CSS, Javascript, Jquery SQL SERVER).


Worked on the HR system for the US-based company.
 In the HR system developing new modules and also maintenance the already modules.
Technologies: ( PHP, HTML, CSS, Javascript, Jquery SQL SERVER).


Worked on the CRM system for the UK-based company.
 In the CRM system developing new modules and also maintenance the already modules.
Technologies: (PHP, HTML, CSS, Javascript, Jquery SQL SERVER).

Small freelance project Milk Sales System
Designed and developed the small Project Milk Sales System
Technologies: (WPF, C#, SQL SERVER).

Small websites and freelance E-commerce websites
Designed and developed  small E-commerce Websites.

Technologies: (PHP, HTML, CSS, Javascript, Jquery SQL SERVER and Joomla ).



In free time writing blogs and practice algorithms and data structures.





Friday, 3 August 2018

Couldn't connect to logcat, GetProcessId returned: 0 (Xamrin Andriod Visual Studio)

Couldn't connect to logcat, GetProcessId returned: 0 (Xamrin Andriod Visual Studio)

Solution: Uninstall APP from emulator. 

Following is a step.

  1. Go to settings.
  2. Find the app
  3.  Uninstall the APP
  4. Close the emulator
  5. Run again the emulator








'adb' is not recognized as an internal or external command, operable program or batch file.

'adb' is not recognized as an internal or external command,operable program or batch file.





 Solution:

Step 1

I have windows 10. Here is adb.exe is located. Copy the following path.

 Step 2:

Go to control panel and click Advanced system settings.

Step 3: Click Environment Variable button.


Step 4

Select Path button and Click Edit button


Step 5:

Paste the adb path here and then click ok and ok


Step 6:

Run again command prompt and type abd.

Sunday, 22 December 2013

Get data from second last row in SQL Server

We have a following table suppliersInformation and we want to Get data from second last row in SQL Server.

Following query shows how to get data from second last row in SQL Server
 
SELECT TOP 1 * FROM
  (SELECT TOP 2* FROM suppliersInformation ORDER BY sup_rec_id DESC) tbl
  ORDER BY sup_rec_id ASC


Wednesday, 18 December 2013

Switch in PHP examples

Example No.1
<?php
$week = "Friday";
switch($week)
{
    case "Sunday":
    echo "Today is Sunday";
    break;
    case "Monday":
    echo "Today is Monday";
    break;
    case "Tuesday":
    echo "Today is Tuesday";
    break;
    case "Wednesday":
    echo "Today is Wednesday";
    break;
    case "Thursday":
    echo "Today is Thursday";
    break;
    case "Friday":
    echo "Today is Friday";
    break;
    case "Saturday":
    echo "Today is Saturday";
    break;
 }

?>
output:
Today is Friday

Example No.2
using default in switch
<?php
$week = "Notavailble";
switch($week)
{
    case "Sunday":
    echo "Today is Sunday";
    break;
    case "Monday":
    echo "Today is Monday";
    break;
    case "Tuesday":
    echo "Today is Tuesday";
    break;
    case "Wednesday":
    echo "Today is Wednesday";
    break;
    case "Thursday":
    echo "Today is Thursday";
    break;
    case "Friday":
    echo "Today is Friday";
    break;
    case "Saturday":
    echo "Today is Saturday";
    break;
    default:
    echo "This weekend is not availabe in our list";
}
?>
output:
This weekend is not availabe in our list

Example NO.3
Always used break keyword in the end of case body.Otherwise you got wrong output.Following example shows What you got when you did not used break keyword

<?php
$week = "Sunday";
switch($week)
{
    case "Sunday":
    echo "Today is Sunday";
   
    case "Monday":
    echo "Today is Monday";
   
    case "Tuesday":
    echo "Today is Tuesday";
   
    case "Wednesday":
    echo "Today is Wednesday";
   
    case "Thursday":
    echo "Today is Thursday";
   
    case "Friday":
    echo "Today is Friday";
   
    case "Saturday":
    echo "Today is Saturday";
   
    default:
    echo "This weekend is not availbe in our list";
}


?>
output:
Today is SundayToday is MondayToday is TuesdayToday is WednesdayToday is ThursdayToday is FridayToday is SaturdayThis weekend is not availbe in our list




Call by refrence in PHP

Following example show orignal value of parameter change.
<?php
function orignalValueChange(&$refParameter)
{
    $refParameter = 4;
  
}
$var = 23;
orignalValueChange($var);
echo $var;

?>
output:
4
Following example show orignal value of parameter not change.

<?php
function orignalValuenotChange($refParameter)
{
    $refParameter = 4;
  
}
$var = 23;
orignalValuenotChange($var);
echo $var;

?>
output:
23

Example

<?php
function callbyref(&$para1, &$para2,&$para3)
{ $para1 = $para2 = $para3;
}
$var1 = 1000;
$var2 = 2000;
$var3 = 3000;
callbyref($var1, $var2,$var3);
$var2 = 5;
echo "<br/>";
echo $var1;

?>
output:
 3000

Tuesday, 17 December 2013

Infinite loop using for loop and while loop in PHP

Followings scripts shows how to run a loop infinite.

Example 1

Using For loop
<?php

for(; ;)
{
   
  echo "infinte loop";
    
}
?>

Example2

 Using While Loop
<?php
while(true)
{
    echo "infinte loop";
   
}
?>

Monday, 16 December 2013

Server Side PHP Date convert in javascript format.

Server Side PHP Date convert in javascript format.


Javascript is a client side scripting language.So when we dealing with dates in javascript.Some time we need the current date of Server using javascript.So we can get a unix time stamp in PHP using strtotime() function in PHP
So following Script give you server Side Date and time in Javascript.

Example

<script type="text/javascript">
var ServerSide = <?=strtotime("now")?>;
var today = new Date(ServerSide * 1000);
alert(today);
</script>

output



Thanks for reading

Sunday, 15 December 2013

Table backup with data in sql server through generate script


We have a following table name tblEmployee in customersdatbs database and we want to back up the table with data through generate script












Step 2

Right click on database.Go to Task=>Generate Script seect. 
step 3
step3

Step 4
Step5
step 6
Step 7
Step 8
 Step 9 Final Step


You got the following Data like this
USE [customersdatbs]
GO
/****** Object:  Table [dbo].[tblEmployee]    Script Date: 12/15/2013 13:06:30 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[tblEmployee](
    [employeeid] [int] IDENTITY(1,1) NOT NULL,
    [name] [varchar](50) NULL,
    [gender] [nvarchar](50) NULL,
    [city] [nvarchar](50) NULL,
 CONSTRAINT [PK_tblEmployee] PRIMARY KEY CLUSTERED
(
    [employeeid] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[tblEmployee] ON
INSERT [dbo].[tblEmployee] ([employeeid], [name], [gender], [city]) VALUES (2, N'name1', N'female', N'karachi')
INSERT [dbo].[tblEmployee] ([employeeid], [name], [gender], [city]) VALUES (3, N'name2', N'female', N'karachi')
INSERT [dbo].[tblEmployee] ([employeeid], [name], [gender], [city]) VALUES (4, N'name3', N'female', N'karachi')
INSERT [dbo].[tblEmployee] ([employeeid], [name], [gender], [city]) VALUES (5, N'name4', N'male', N'kpk')
SET IDENTITY_INSERT [dbo].[tblEmployee] OFF




Save the script for future use

Thanks for reading





   


 

if else in PHP example

If condition always run when condition is true e.g  if(true){} 
Example No.1
<?php
$true = true;
$false = false;

if($true == true)
{
 echo "This is true";
}else
{
     echo "This is flase";
}

?>
ouput:
This is true


Example No.2
<?php
$true = true;
$false = false;

if($true == $false)
{
 echo "I like mango";
}else
{
     echo "I like appple";
}

?>
ouput:
I like appple

Example No.3

<?php
$true = true;
$false = false;

if($true!== $false)
{
 echo "I like mango";
}else
{
     echo "I like appple";
}

?>
ouput:
I like mango

Example No.4
Using string comparison
 

<?php
$string1 = "BMW";
$string2 = "BMW";

if($string1 == $string2)
{
 echo $string1." ".$string2;
}else
{
     echo "It is else";
}

?>
ouput:
BMW BMW