functions
On this page
Function reference

sqlpage.header(name)

Since SQLPage 0.7.2

Reads one HTTP request header. Names are case-insensitive: sqlpage.header('User-Agent') and sqlpage.header('user-agent') read the same value. An absent header returns SQL NULL.

Example

Log the User-Agent of the browser making the request in the database:

INSERT INTO user_agent_log (user_agent) VALUES (sqlpage.header('user-agent'));

If you need access to all headers at once, use sqlpage.headers() instead.

Parameters

name TEXT Required

The name of the HTTP header to read.