logo Online Learner
  • Home
  • Learning Paths
  • Development
    Frontend Development Backend Development
  • Study Notes
  • Free Resume Builder
  • About Us
  • Contact Us
  • Login
  • Sign Up
  1. Learning Paths
  2. Next.js Tutorial
  3. Next js Navigation and Link

Next.js Navigation & Link

The Next.js Link component is the primary way to move between pages without a full browser reload. It wraps a normal anchor tag and adds client-side navigation, prefetching, and automatic scroll handling. Using it correctly makes your app feel fast and responsive.

This tutorial covers the Link component, its props, and the hooks that handle programmatic navigation and active link styling. You will build a navigation bar that highlights the current page and a button that redirects after a click. If you are new to routing, start with Next.js Pages & Layouts first.

What Is the Next.js Link Component and Why Use It?

The Next.js Link component is a built-in wrapper around the HTML anchor tag. It enables client-side navigation, meaning the browser does not request a new HTML page from the server. Instead, Next.js fetches the new route's data and swaps the content in place. Link also prefetches routes automatically when they enter the viewport .

A plain <a> tag triggers a full page reload. The browser discards all JavaScript state and starts over. Link avoids this by using the App Router's client-side navigation system. The result is faster transitions and preserved layout state.

// app/page.tsx
import Link from "next/link";

export default function HomePage() {
  return (
    <main>
      <h1>Home</h1>
      <Link href="/about">Go to About</Link>
    </main>
  );
}
Browser shows:
Home
Go to About   ← clicking this changes the URL to /about without a full reload

How it works: Link renders an anchor element in the HTML for accessibility and SEO. When clicked, Next.js intercepts the navigation, fetches the /about route, and updates the page without reloading the browser. The address bar changes, and the back button works normally.

How Does Link Handle Dynamic Segments and Special Props?

Link accepts a string href or a template literal for dynamic routes. It also has two props that control scrolling and history behavior: scroll and replace .

Dynamic Segments with Template Literals

// app/blog/page.tsx
import Link from "next/link";

const posts = [
  { slug: "first-post", title: "First Post" },
  { slug: "second-post", title: "Second Post" },
];

export default function BlogListPage() {
  return (
    <ul>
      {posts.map((post) => (
        <li key={post.slug}>
          <Link href={`/blog/${post.slug}`}>{post.title}</Link>
        </li>
      ))}
    </ul>
  );
}

How it works: The template literal builds the URL path from each post's slug. Next.js matches it to the dynamic route file app/blog/[slug]/page.tsx. The Next.js Dynamic Routes tutorial covers the folder convention in detail.

scroll and replace Props

// app/help/page.tsx
import Link from "next/link";

export default function HelpPage() {
  return (
    <main>
      <h1>Help</h1>
      <Link href="/faq" scroll={false}>FAQ (keep scroll position)</Link>
      <Link href="/login" replace>Login (no history entry)</Link>
    </main>
  );
}

How it works: By default, navigating to a new page scrolls to the top. scroll={false} keeps the current scroll position. The replace prop replaces the current history entry instead of adding a new one, so the user cannot press Back to return to the previous page. This is useful for login redirects.

How Do You Navigate Programmatically with useRouter?

The useRouter hook from next/navigation lets you change routes from code, such as after a button click or a form submission. It only works inside Client Components, so the file needs "use client" .

// app/components/NavigateButton.tsx
"use client";

import { useRouter } from "next/navigation";

export default function NavigateButton() {
  const router = useRouter();

  return (
    <button onClick={() => router.push("/dashboard")}>
      Go to Dashboard
    </button>
  );
}
Browser shows:
Go to Dashboard   ← clicking pushes the /dashboard route into history

How it works: router.push navigates to the new route and adds an entry to the browser history stack. router.replace does the same but replaces the current entry. router.back goes to the previous page. router.refresh re-fetches the current route's data without a full reload . Remember: import useRouter from next/navigation, not next/router. The latter is the legacy Pages Router import.

How Do You Highlight the Active Link with usePathname?

The usePathname hook returns the current URL path as a string. You compare it to each link's href to decide whether the link is active. This replaces the old router.pathname pattern from the Pages Router .

// app/components/NavBar.tsx
"use client";

import Link from "next/link";
import { usePathname } from "next/navigation";

const links = [
  { href: "/", label: "Home" },
  { href: "/about", label: "About" },
  { href: "/dashboard", label: "Dashboard" },
];

export default function NavBar() {
  const pathname = usePathname();

  return (
    <nav>
      {links.map((link) => {
        const isActive = pathname === link.href;
        return (
          <Link
            key={link.href}
            href={link.href}
            style={{ fontWeight: isActive ? "bold" : "normal" }}
          >
            {link.label}
          </Link>
        );
      })}
    </nav>
  );
}
Browser shows at /about:
Home   About (bold)   Dashboard

How it works: usePathname returns the current path, such as /about. The component compares it to each link's href. When they match, isActive is true and the style changes. For routes with sub-paths, you can use pathname.startsWith(link.href) instead of strict equality .

How Does redirect Work in Server Components?

The redirect function from next/navigation sends the user to another URL from a Server Component. It throws a special error that Next.js catches and converts into an HTTP redirect response .

// app/admin/page.tsx
import { redirect } from "next/navigation";

export default async function AdminPage() {
  const isLoggedIn = false;

  if (!isLoggedIn) {
    redirect("/login");
  }

  return <h1>Admin Panel</h1>;
}
Browser behavior: navigating to /admin while not logged in
redirects to /login automatically.

How it works: When redirect is called, Next.js stops rendering the current route and sends a redirect response to the browser. The function does not return, so you do not need to write return redirect(). In Server Actions and Route Handlers, redirect should be called outside try/catch blocks because it works by throwing an error.

How Does Prefetching Make Navigation Faster?

Link automatically prefetches routes when they become visible in the viewport. Prefetching means Next.js loads the route's code and data in the background before the user clicks. When the click happens, the transition feels instant .

Route Type Prefetch Behavior
Static routes The entire route is prefetched and cached by default.
Dynamic routes Only the shared layout up to the first loading.tsx is prefetched and cached for 30 seconds.

Prefetching runs only in production, not in development mode. You can disable it per link with prefetch={false}, but most of the time the default is fine. The benefit is fewer loading spinners and faster perceived performance.

Common Mistakes and Best Practices

  • Importing useRouter from next/router. In the App Router, the correct import is next/navigation. The old path is for the Pages Router and will not work in the app directory.
  • Using <a> for internal links. A plain anchor causes a full page reload and loses client state. Use Link for every route inside your Next.js app.
  • Forgetting "use client" when using hooks. useRouter and usePathname only work in Client Components. Without the directive, Next.js throws an error.
  • Comparing pathnames without handling sub-routes. pathname === "/blog" will not highlight the Blog link when the user is at /blog/first-post. Use startsWith for parent links if you want them active on child pages.
  • Calling router.push with unsanitized input. Never pass user-controlled strings directly to router.push or router.replace. Malicious URLs can execute scripts in your page context.

Real-World Example: A Navigation Bar with Active Highlight and a Redirect Button

This example combines a NavBar Client Component that highlights the active link, and a separate button component that navigates programmatically.

app/
  layout.tsx
  components/
    NavBar.tsx
    GoToDashboard.tsx
  page.tsx
  about/
    page.tsx
  dashboard/
    page.tsx
// app/components/NavBar.tsx
"use client";

import Link from "next/link";
import { usePathname } from "next/navigation";

const links = [
  { href: "/", label: "Home" },
  { href: "/about", label: "About" },
  { href: "/dashboard", label: "Dashboard" },
];

export default function NavBar() {
  const pathname = usePathname();

  return (
    <nav>
      {links.map((link) => {
        const isActive = pathname === link.href;
        return (
          <Link
            key={link.href}
            href={link.href}
            style={{ fontWeight: isActive ? "bold" : "normal" }}
          >
            {link.label}
          </Link>
        );
      })}
    </nav>
  );
}
// app/components/GoToDashboard.tsx
"use client";

import { useRouter } from "next/navigation";

export default function GoToDashboard() {
  const router = useRouter();

  return (
    <button onClick={() => router.push("/dashboard")}>
      Open Dashboard
    </button>
  );
}

Line-by-line explanation: The NavBar file starts with "use client" because it uses usePathname, a client-side hook. It imports Link from next/link and the hook from next/navigation. The links array holds the route and label for each navigation item. Inside the component, pathname gives the current URL. The map loop builds a Link for each entry. When pathname equals the link's href, the font weight becomes bold. The GoToDashboard component uses useRouter to get the router instance. The button's click handler calls router.push("/dashboard"), which navigates without a full reload. Both components live in app/components/ and can be imported into app/layout.tsx to appear on every page.

Summary

  • The Next.js Link component enables client-side navigation and replaces the plain anchor tag for internal routes.
  • Link prefetches visible routes automatically, making transitions feel instant in production.
  • Use useRouter from next/navigation for programmatic navigation. Import it from next/navigation, not next/router.
  • usePathname returns the current path. Compare it to link hrefs to highlight the active link.
  • redirect works in Server Components and sends an HTTP redirect response.
  • Common props like scroll and replace control scroll behavior and history entries.

Now that you can navigate between static pages, continue to Next.js Dynamic Routes to learn how to build routes that accept parameters in the URL.

Frequently Asked Questions

Can I use a normal anchor tag instead of Link in Next.js?

You can, but it causes a full page reload. The browser discards all JavaScript state, and the layout remounts. Use Link for any route inside your Next.js app. Reserve plain <a> tags for external websites, email links, or downloadable files.

Why is useRouter not working in my component?

useRouter only works in Client Components. Add "use client" at the very top of the file before any imports. Also check that you imported it from next/navigation, not next/router. The Pages Router import does not work in the app directory.

Does Link prefetch every route on the page?

Link prefetches routes when they become visible in the viewport. Links below the fold are prefetched only after the user scrolls them into view. Prefetching also runs only in production mode, not during development. You can disable it per link with prefetch={false}.

How do I make a link active for child routes?

Use pathname.startsWith(link.href) instead of strict equality. For example, "/blog" should be active when the path is "/blog/first-post". Handle the root path "/" separately with strict equality, otherwise every route would highlight the Home link.

What is the difference between router.push and redirect?

router.push is a client-side navigation method from the useRouter hook. It works in event handlers inside Client Components. redirect is a server-side function that throws an error and sends an HTTP redirect response. Use router.push for button clicks and redirect for server-side conditions like authentication checks.

Practice Exercises

Easy: Create a Basic Link

Create a page at app/contact/page.tsx with a heading. On the home page, add a Link that navigates to /contact.

Show solution
// app/page.tsx
import Link from "next/link";

export default function HomePage() {
  return (
    <main>
      <h1>Home</h1>
      <Link href="/contact">Contact Us</Link>
    </main>
  );
}
// app/contact/page.tsx
export default function ContactPage() {
  return <h1>Contact</h1>;
}

Link handles the navigation without a full page reload.

Easy: Add a replace Link

Create a link to /login that uses the replace prop. Explain what happens to the browser history.

Show solution
// app/page.tsx
import Link from "next/link";

export default function HomePage() {
  return <Link href="/login" replace>Login</Link>;
}

The replace prop replaces the current history entry. The user cannot press Back to return to the previous page.

Medium: Highlight Active Link

Build a two-link navigation component for / and /about. Use usePathname to add bold styling to the active link.

Show solution
// app/components/SimpleNav.tsx
"use client";

import Link from "next/link";
import { usePathname } from "next/navigation";

export default function SimpleNav() {
  const pathname = usePathname();

  return (
    <nav>
      <Link href="/" style={{ fontWeight: pathname === "/" ? "bold" : "normal" }}>
        Home
      </Link>
      <Link
        href="/about"
        style={{ fontWeight: pathname === "/about" ? "bold" : "normal" }}
      >
        About
      </Link>
    </nav>
  );
}

usePathname returns the current path, and the style changes based on a strict match.

Challenge: Redirect Button with useRouter

Create a Client Component with a button. When clicked, the button calls router.push to navigate to /dashboard. The button should appear on the home page.

Show solution
// app/components/DashboardButton.tsx
"use client";

import { useRouter } from "next/navigation";

export default function DashboardButton() {
  const router = useRouter();

  return (
    <button onClick={() => router.push("/dashboard")}>
      Go to Dashboard
    </button>
  );
}
// app/page.tsx
import DashboardButton from "./components/DashboardButton";

export default function HomePage() {
  return (
    <main>
      <h1>Home</h1>
      <DashboardButton />
    </main>
  );
}

useRouter from next/navigation provides the push method for programmatic navigation.



Shaikh Abdul Shahid
Written by Shaikh Abdul Shahid

A Full-Stack Developer with experience in PHP, Laravel, JavaScript, and React.
Founder of Online Learner, sharing practical knowledge and programming tutorials.
Building and maintaining real-world web applications since 2017.

GitLab LinkedIn
X
0 likes
Your Feedback

Help us improve by sharing your thoughts.

IT and Digital Marketing
keyboard_arrow_left Previous
Next keyboard_arrow_right
Online Learner Logo

Online Learner helps developers master programming, database concepts, interview preparation, and real-world implementation through structured learning paths.

Quick Links

  • Frontend Development
  • Backend Development
  • Learning Paths
  • Notes
  • Free Resume Builder
  • Portfolio

Company

  • About Us
  • Contact Us
  • Terms & Conditions
  • Disclaimer

© 2023 - 2026 OnlineLearner.in | All Rights Reserved.

logo
  • code Frontend
  • storage Backend
  • live_help Interviews
  • work_outline PHP Frameworks
  • settings Routine Use
  • book Blogs
Frontend
  • HTML Tutorial
    • HTML Introduction
    • HTML Tags
    • HTML Elements
    • HTML Attributes
    • HTML Heading
    • HTML Paragraph
    • HTML Formatting
    • HTML Quotations
    • HTML Comments
    • HTML Styles
    • HTML Color
    • HTML CSS
    • HTML Images
    • HTML Favicon
    • HTML Links
    • HTML DIV
    • HTML Tables
    • HTML Table Size
    • HTML Table Head
    • Table Padding & Spa...
    • Table colspan rowspsn
    • HTML Table Styling
    • HTML Colgroup
    • HTML List
    • HTML Block & Inline
    • HTML Classes
    • HTML Id
    • HTML Iframes
    • HTML Head
    • HTML Layout
    • HTML Semantic Elements
    • HTML Style Guide
    • HTML Forms
    • HTML Form Attribute
    • HTML Form Element
    • HTML input type
    • HTML Computer code
    • HTML Entity
    • HTML Symbol
    • HTML Emojis
    • HTML Charset
    • HTML Input Form Att...
    • HTML URL Encoding
  • CSS Tutorial
    • CSS Introduction
    • CSS Syntax
    • CSS Selector
    • How To Add CSS
    • CSS Comments
    • CSS Colors
    • CSS Background color
    • CSS background-image
    • CSS Borders
    • CSS Margins
    • CSS Height, Width a...
    • CSS Box Model
    • CSS Outline
    • CSS Text
    • CSS Fonts
    • CSS Icon
    • CSS Links
    • CSS Tables
    • CSS Display
    • CSS Maximum Width
    • CSS Position
    • z-index Property
  • JavaScript Tutorial
    • What is JavaScript
    • JS Syntax
    • JS Variables
    • JS Data Types
    • JS Operators
    • JS Control Flow - IF
    • JS Control Flow - S...
    • JS Control Flow - Loop
    • JS Function
    • JS Object Methods
    • JS Anonymous Funct...
    • JS Recursive Function
    • JS Default Parameters
    • JS this Keyword
    • What is an Array in...
    • What are JavaScript...
    • Error Handling in J...
    • DOM Selection in Ja...
    • DOM Traversal in Ja...
    • Manipulating Elemen...
    • Event Handling in J...
    • JavaScript Event Li...
    • JavaScript Event Pr...
    • Form Handling in Ja...
    • Dynamic Styling in ...
    • JavaScript DOM Elem...
    • Window Object in Ja...
    • What is Local Storage?
    • Regular Expressions...
  • Jquery Tutorial
    • What is jQuery?
    • Benefits of using j...
    • Include jQuery
    • Selectors.
    • Methods.
    • The $ symbol and sh...
    • Selecting elements
    • Getting and setting...
    • Adding and removing...
    • Modifying CSS and c...
    • Binding and Unbindi...
    • Common events: clic...
    • Event delegation
    • Using .on() for dyn...
    • Showing and hiding ...
    • Fading elements in ...
    • Sliding elements up...
    • .animate()
    • Understanding AJAX
    • .ajax()
    • .load(), .get(), .p...
    • Handling responses ...
    • Parent
    • Chlid
    • Siblings
    • Filtering Elements
    • Using find
    • Selecting form elem...
    • Getting form values
    • Setting form values
    • Form validation
    • Handling form submi...
    • jQuery plugins
    • Sliders plugins
    • $.each()
    • $.trim()
    • $.extend()
    • Data attributes
    • Debugging jQuery code
  • Bootstrap 4
    • What is Bootstrap
    • Benefits of using
    • Setting up
    • Container
    • Row and Column
    • Grid Classes
    • Breakpoints
    • Offsetting Columns
    • Column Ordering
    • Basic Typography
    • Text Alignment
    • Text colors
    • Backgrounds
    • Display
    • Font Size Utilities
    • Buttons
    • Navs and Navbar
    • Forms
    • Cards
    • Alerts
    • Badges
    • Progress Bars
    • Margin
    • Padding
    • Sizing
    • Flexbox
    • Dropdowns
    • Modals
    • Tooltips
    • Popovers
    • Collapse
    • Carousel
    • Images
    • Tables
    • Jumbotron
    • Media Object
  • Git
    • Understanding Versi...
    • Download and Instal...
    • Git Configure
    • Git Initialize
    • Add Changes to Staging
    • Commit Changes
    • Branching
    • Merging
    • Remote Repository
    • Understanding Git C...
    • Stashing Changes
    • Viewing Commit History
    • Undoing Changes
  • Ajax Tutorial
    • Ajax Fundamentals
    • Ajax Working
    • XMLHttpRequest Fetch
    • Synchronous vs Asyn...
    • Ajax Advantages
    • Ajax Disadvantages
    • $.ajax() method
    • Ajax GET request
    • Ajax POST Request
    • Json Response
    • Ajax Errors
    • Ajax Form
  • React Tutorial
    • What is React? Begi...
    • React Environment S...
    • React Fundamentals:...
    • Functional vs Class...
    • Props in React Expl...
    • State and setState ...
    • React Event Handling
    • React Conditional R...
    • React Lists and Keys
    • Styling in React In...
    • Styling in React Us...
    • Styling in React Us...
    • Tailwind CSS with R...
    • Tailwind vs CSS Mod...
    • React Hooks
    • React useState Hook
    • React useEffect Hook
    • React useRef Hook
    • React useContext Hook
    • React useReducer Hook
    • Custom Hooks in React
    • React Router – In...
    • Installing React Ro...
    • React Router – Ro...
    • React Router – Ne...
    • React Router URL Pa...
    • React Router Protec...
    • React Router Redire...
    • State Management in...
    • Redux State Managem...
    • Redux Toolkit Expla...
    • Redux Toolkit vs Re...
    • Controlled vs Uncon...
    • Handling Form Input...
    • API Integration in ...
    • Axios in React – ...
    • Handling Loading an...
    • Async Await in Java...
    • Displaying API Data...
    • CRUD Operations in ...
    • React Performance O...
    • React Performance O...
  • Tailwind
    • Introduction to Tai...
    • Utility-First CSS E...
    • Tailwind CSS vs Boo...
    • When and Why to Use...
    • Real-World Use Case...
    • Tailwind CSS Instal...
    • Installing Tailwind...
    • Tailwind CSS with V...
    • Setting Up Tailwind...
    • Install Tailwind CS...
    • Tailwind CSS Colors...
    • Tailwind CSS Backgr...
    • Tailwind CSS Paddin...
    • Tailwind CSS Margin...
    • Tailwind CSS Width ...
    • Tailwind CSS Height...
    • Tailwind CSS Border...
    • Tailwind CSS Border...
    • Tailwind CSS Text S...
    • Tailwind CSS Box Sh...
    • Tailwind CSS Opacit...
    • Tailwind CSS Cursor...
    • Tailwind CSS Overfl...
    • Tailwind CSS Font S...
    • Tailwind CSS Font W...
    • Tailwind CSS Text A...
    • Tailwind CSS Line H...
    • Tailwind CSS Letter...
    • Tailwind CSS Text T...
    • How to Use Google F...
    • Flexbox with Tailwi...
    • Justify Content in ...
    • Align Items in Tail...
    • Flex Direction in T...
    • Gap in Tailwind CSS...
    • Flexbox with Tailwi...
    • Grid System in Tail...
    • Grid System in Tail...
    • Responsive Design i...
    • Positioning & Z-Ind...
    • Background Colors i...
    • Background Images i...
    • Gradients in Tailwi...
    • Image Object-Fit in...
    • Image Overlay Effec...
    • Buttons in Tailwind...
    • Hover & Focus State...
    • Buttons and Forms i...
    • Cards and Sections ...
    • Navbar and Footer D...
  • TypeScript Tutorial
    • TypeScript Introduc...
    • TypeScript Installa...
    • First TypeScript Pr...
    • TypeScript Basic Types
    • Type Inference and ...
    • TypeScript Arrays a...
    • TypeScript Enums
    • TypeScript Any, Unk...
    • TypeScript Interfaces
    • Type Aliases and Un...
    • Intersection Types
    • Literal Types
    • Functions in TypeSc...
    • Classes in TypeScript
    • Access Modifiers an...
    • Abstract Classes
    • TypeScript Generics
    • TypeScript Utility ...
    • Type Guards and Nar...
    • Modules and Namespaces
    • TypeScript Decorators
    • TypeScript with React
    • TypeScript with Nod...
  • Next.js Tutorial
    • Introduction to Nex...
    • Next js Setup and P...
    • Next js App Router ...
    • Next js Pages and L...
    • Next js Navigation ...
    • Next js Dynamic Routes
    • Next js Route Groups
    • Next js Middleware
    • Server vs Client Co...
    • SSR, SSG and ISR Ex...
    • Next js Loading and...
Backend
  • PHP Tutorial
    • PHP Introduction
    • PHP Installation
    • PHP Syntax
    • PHP Comments
    • PHP Variable
    • PHP Echo
    • PHP Data Types
    • PHP Strings
    • PHP Constant
    • PHP Maths
    • PHP Number
    • PHP Operators
    • PHP if else & if el...
    • PHP Switch
    • PHP Loops
    • PHP Functions
    • PHP Array
    • PHP OOps
    • PHP Class & Object
    • PHP Constructor
    • PHP Destructor
    • PHP Access Modfiers
    • PHP Inheritance
    • PHP Final Keyword
    • PHP Class Constant
    • PHP Abstract Class
    • PHP Superglobals
    • PHP Regular Expression
    • PHP Interfaces
    • PHP Static Method
    • PHP Static Properties
    • PHP Namespace
    • PHP Iterable
    • PHP Form Introduction
    • PHP Form Validation
    • PHP Complete Form
    • PHP Date and Time
    • PHP Include Files
    • PHP - Files & I/O
    • File Upload
    • PHP Cookies
    • PHP SESSION
    • PHP Filters
    • PHP Callback Functions
    • PHP JSON
    • PHP AND Exceptions
    • PHP Connect database
  • PHP Functions
    • strlen
    • strtoupper
    • strtolower
    • ucfirst
    • ucwords
    • substr
    • str_replace
    • strpos
    • trim in php
    • explode
    • implode
    • count in php
    • array_merge
    • array_push
    • array_pop
    • array_shift
    • array_unshift
    • in_array
    • array_keys
    • array_values
    • array_filter
    • array_map
    • sort
    • asort
    • ksort
    • abs
    • round
    • ceil
    • floor
    • rand
    • mt_rand
    • max
    • min
    • pow
    • sqrt
    • date
    • time
    • strtotime
    • mktime
    • date_diff
    • getdate
    • fopen
    • fread
    • fwrite
    • fclose
    • file_get_contents
    • file_put_contents
    • file_exists
    • unlink
    • filesize
    • is_readable
    • is_writable
    • urlencode
    • urldecode
    • parse_url
    • http_build_query
    • isset
    • empty
    • is_numeric
    • is_array
    • is_string
    • filter_var
    • htmlspecialchars
    • md5
    • sha1
    • password_hash
    • password_verify
    • die
    • exit
    • var_dump
    • print_r
    • include
    • require
    • json_encode
    • json_decode
    • sleep
  • PHP and MySQL Functions
    • mysqli_connect
    • mysqli_select_db
    • mysqli_query
    • mysqli_prepare
    • mysqli_stmt_execute
    • mysqli_multi_query
    • mysqli_fetch_assoc
    • mysqli_fetch_array
    • mysqli_fetch_row
    • mysqli_fetch_object
    • mysqli_num_rows
    • mysqli_real_escape_...
    • mysqli_insert_id
    • mysqli_affected_rows
    • mysqli_error
    • mysqli_close
    • mysqli_commit
    • mysqli_rollback
  • Python Tutorial
    • What is Python?
    • Install Python on W...
    • Install Python on L...
    • Install Python on m...
    • IDE Setup
    • Python syntax
    • Python Comments
    • Python Indentation
    • Python Variables
    • Python Data Types
    • Python Numeric
    • Python Boolean
    • Python String
    • Python List
    • Python Tuple
    • Python Range
    • Python Dictionary
    • Python Arithmetic O...
    • Python Assignment O...
    • Python Comparison O...
    • Python Logical Oper...
    • Python Bitwise Oper...
    • Python if condition
    • Python if else cond...
    • Python For Loop
    • Python While Loop
    • Python break, conti...
  • MYSQL
    • SQL Introduction
    • Syntax
    • Select statement
    • Select Distinct
    • WHERE Clause
    • Order By
    • SQL AND Operator
    • SQL OR Operator
    • SQL NOT Operator
    • SQL LIKE
    • SQL IN
    • SQL BETWEEN
    • SQL INSERT INTO
    • SQL NULL Values
    • SQL UPDATE
    • SQL DELETE
    • SQL TOP, LIMIT, FET...
    • SQL MIN() and MAX()...
    • SQL COUNT() Function
    • SQL SUM()
    • SQL AVG()
    • SQL Aliases
    • SQL JOIN
    • SQL INNER JOIN
    • SQL LEFT JOIN
    • SQL RIGHT JOIN
    • SQL FULL OUTER JOIN
    • SQL Self Join
    • SQL UNION
    • SQL GROUP BY
    • SQL HAVING
    • SQL EXISTS
    • SQL ANY and ALL
    • SQL SELECT INTO
    • SQL INSERT INTO SELECT
    • SQL CASE
    • SQL NULL Functions
    • SQL Stored Procedures
    • SQL Comments
    • SQL Operators
    • SQL CREATE DATABASE
    • SQL DROP DATABASE
    • SQL BACKUP DATABASE
    • SQL CREATE TABLE
    • SQL DROP TABLE
    • SQL ALTER TABLE
    • SQL Constraints
    • SQL NOT NULL
    • SQL UNIQUE Constraint
    • SQL PRIMARY KEY
    • SQL FOREIGN KEY
    • SQL CHECK Constraint
    • SQL CREATE INDEX
    • SQL AUTO INCREMENT
    • SQL Dates
    • SQL Views
    • SQL Injection
    • SQL Hosting
    • SQL Data Types
  • Node Js
    • What is Node.js?
    • Why use Node.js?
    • Installing Node.js
    • First Node.js progr...
    • Event Loop
    • Understanding npm
    • What are Modules?
    • fs (File System)
    • Http Module
    • Path Module
    • Creating custom mod...
    • Exporting and impor...
    • Setting up a basic ...
    • Handling requests a...
    • Serving HTML
    • Serving CSS
    • Serving JavaScript
  • Python MySQL
    • Database Connection
    • Table Creation
    • Insert Query
    • Select Query
    • Update Query
    • Delete Query
    • Where Clause Query
    • Limit Clause Query
    • Join Tables
    • Order By Query
    • Group By Query
    • Aggregate Functions
    • Parameterized Query
  • Java Tutorials
    • Java Introduction
    • Java Installation
    • Java Syntax
    • Java Comments
    • Java Variables
    • Java DataTypes
    • Java Operators
    • Java Conditionals
    • Java Looping
    • Java Arrays
    • Java Methods
    • Java Classes
    • Java Objects
    • Java Constructors
    • Java Inheritance
    • Java Polymorphism
    • Java Encapsulation
    • Java Abstraction
    • Java Exception
    • Java Interfaces
    • Java File Handling
    • Java Threads
    • Java Access Modifiers
    • Java Static Keyword
    • Java Final Keyword
    • Java Nested Class
    • Java Synchronization
  • Docker
    • Introduction to Docker
    • Installing Docker
    • Docker Architecture
    • Docker Images
    • Docker Containers
    • Dockerfile Basics
    • Docker Volumes
    • Docker Networking
    • Docker Compose
    • Docker Hub & Registry
    • Multi-Stage Builds
    • Docker with Nginx
    • Docker with MySQL
    • Docker with PHP & L...
    • Docker Environment ...
    • Docker Logs & Debug...
    • Docker Security Bes...
    • Docker Swarm Basics
    • Docker vs Virtual M...
    • Real World Docker P...
Interviews
  • PHP Interviews
    • What is PHP?
    • What does PHP stand...
    • PHP Advantages
    • Difference between ...
    • Start a PHP script?
    • Commenting in PHP
    • Variable in PHP
    • Different types of ...
    • Different types of ...
    • Array in PHP
    • Difference between ...
    • Retrieve data from ...
    • PHP handle errors
    • Sessions in PHP
    • PHP Cookie
    • What are the main f...
    • What are the differ...
    • What are the differ...
  • Java Interview Questions
    • Java Basics – Wha...
    • What is the differe...
    • What are the OOP co...
    • Why is the main met...
    • What are the differ...
    • What is the differe...
    • What is Method Over...
    • What is the Differe...
    • What is the Constru...
    • What are the Access...
    • What is the this Ke...
    • What is the super K...
    • What is the static ...
    • What is the final K...
    • What is Exception H...
    • What are Checked an...
    • What is the Differe...
    • What are Multithrea...
    • What is the Java Co...
    • What is the Differe...
    • What is the Differe...
    • What is the Differe...
    • What is the Differe...
    • How Does HashMap Wo...
    • What is the Differe...
    • What is the Differe...
    • What is the String ...
    • What is the Differe...
    • What is Garbage Col...
    • What is the Differe...
    • What is a Lambda Ex...
    • What is the Stream ...
    • What are Optional C...
    • What is the Differe...
    • What are the Key Fe...
    • What is the Record ...
  • React Interviews
    • What is React.js
    • Help In Interviews
    • Features of React
    • What is JSX
    • React's Virtual DOM
    • State and Props
    • React handle data b...
    • React Component
    • setState() method.
    • Controlled Components
    • Lifecycle Methods
    • Significance of keys
    • What are the differ...
  • Laravel Interviews
    • What is Laravel?
    • What are the key fe...
    • Explain the concept...
    • What is a controlle...
    • What is Blade templ...
    • How does Eloquent O...
    • Explain the concept...
    • What are middleware...
    • How do you create a...
    • What is CSRF protec...
    • What is the purpose...
    • What is the purpose...
    • Explain the concept...
    • How do you create a...
    • What is the purpose...
    • How do you define r...
    • What are named rout...
    • Explain the use of ...
    • What is the purpose...
    • What are service pr...
  • SQL Interviews
    • What is SQL?
    • What are the differ...
    • What is the differe...
    • What is a primary key?
    • What is a foreign key?
    • What are the differ...
    • What is the differe...
    • What is the use of ...
    • What is the differe...
    • What is an index in...
    • What types of index...
    • What is a subquery?
    • How do you use the ...
    • How can you find th...
    • Explain the use of ...
    • What is a view?
    • What are the limita...
    • Write a query to fe...
    • Write a query to fe...
    • Write a query to co...
    • Write a query to fe...
    • Write a query to fe...
    • Write a query to fi...
    • Write a query to fe...
    • Write a query to re...
    • Write a query to ge...
    • Write a query to ge...
    • Write a query to li...
    • Write a query to fi...
    • Write a query to fi...
    • Write a query to ge...
    • Write a query to fi...
    • Write a query to co...
    • Write a query to fi...
    • Write a query to li...
    • Write a query to fe...
    • Write a query to fi...
    • Write a query to fe...
    • Write a query to ge...
    • Write a query to co...
    • Write a query to fe...
  • JavaScript Interview Questions
    • What Exactly is Jav...
    • What are the data t...
    • What is the differe...
    • JavaScript double e...
    • What is a Closure i...
    • What is Hoisting in...
    • Understanding "this...
    • What Are JavaScript...
    • Null vs Undefined i...
    • How Does JavaScript...
    • What is a Promise i...
    • Async/Await in Java...
    • Event Delegation in...
    • JavaScript Modules ...
    • How to Prevent a Fu...
    • JavaScript Intervie...
    • JavaScript Intervie...
    • What is bind() in J...
    • Event Bubbling vs. ...
    • Deep Copy vs Shallo...
    • What is the new Key...
PHP Frameworks
  • Laravel
    • Laravel Topics
    • Laravel 7 Installation
    • Install laravel 8
    • Laravel 8 Routing
    • Laravel Controllers
    • Views and Blade lar...
    • Database and Eloque...
    • Authentication and ...
    • CSRF Protection
    • Laravel Model
    • Database: Query Bui...
Routine Use
  • Linux
    • How to Delete a Fil...
    • Install lemp in ubu...
    • How to check packag...
    • Navigating the File...
    • Managing Files and ...
    • Viewing and Editing...
    • Managing Processes ...
    • Scheduling Tasks wi...
    • Disk Usage Analysis...
    • File and Directory ...
Blogs
  • Blogs
    • Free Hosting on AWS...
    • PHP 8.6 Partial Fun...
    • What is SEO?
    • Zoho Free Mail
    • Speed Up Your Appli...
    • What is a JavaScrip...
    • Laravel vs Lumen: T...
    • MySQL vs PostgreSQL...
    • Automate Free MySQL...
    • How to Use Google A...
    • What is n8n?
    • Cloud Platform Comp...
    • Top Common Mistakes...
    • PHP 8.5: The Pipeli...
    • Google Antigravity ...
    • How to Optimize Que...
    • React vs Angular vs...
    • Base44: Features, P...
    • Difference Between ...
    • HTTP Status Codes E...
    • Build Native Mobile...
    • Top 10 JavaScript F...
    • JIRA, Waterfall, an...
    • WebSockets in Moder...
    • A Complete Real-Wor...
    • Why Developers Shou...
    • Service-Based Compa...
    • Bootstrap vs Tailwi...
    • Direct Prompt vs St...
    • Top 25 SEO HTML Tag...
    • Docker Commands Che...
    • Authentication vs A...
    • Top AI Portals in 2...
    • What is Replit? Com...
    • Laravel 13 Released...
    • NEET Paper Leak Pre...