To set NOT NULL, use IS NOT NULL and find the value. The syntax is as follows −select if('' is not NULL, 1, 0) as anyAliasName;Here is the working query −mysql> select if('' is not NULL, 1, 0);This will produce the following output −+------------------------+ | if('' is not NULL, 1, 0) | +------------------------+ | 1 | +------------------------+ 1 row in set (0.00 sec)To understand the above syntax, let us create a table −mysql> create table DemoTable1915 ( Name varchar(20) ); Query OK, 0 rows affected (0.00 sec)Insert ... Read More
The pack() function packs data into a binary string.Syntaxpack(format , args)Parametersformat − The format to use. Here are the possible values −a − NUL-padded stringA − SPACE-padded stringh − Hex string, low nibble firstH − Hex string, high nibble firstc − signed charC − unsigned chars − signed short (always 16 bit, machine byte order)S − unsigned short (always 16 bit, machine byte order)n − unsigned short (always 16 bit, big endian byte order)v − unsigned short (always 16 bit, little endian byte order)i − signed integer (machine dependent size and byte order)I − unsigned integer (machine dependent size and ... Read More
For this, use SET yourColumnName = NULL as in the below syntax −update yourTableName set yourColumnName=NULL where yourColumnName=yourValue;Let us first create a table −mysql> create table DemoTable1914 ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, Code varchar(20) )AUTO_INCREMENT=1001; Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1914(Code) values('John101'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1914(Code) values('234David'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1914(Code) values('100_Mike'); Query OK, 1 row affected (0.00 sec)Display all records from the table using select ... Read More
The ignore_user_abort() function sets whether a remote client can abort the running of a script.Syntaxignore_user_abort(setting)Parameterssetting − True ignores user aborts in a script (the script will continue to run). This is false by default i.e. client aborts will cause the script to stop runningReturnThe ignore_user_abort() function returns previous value of the user-abort setting.ExampleThe following is an example that sets to false i.e. the default. Client aborts will cause the script to stop running.OutputThe following is the output.0
The highlight_string() function outputs a string with the PHP syntax highlighted.Syntaxhighlight_string(string, return)Parametersstring − The string to highlight.return −If this parameter is set to true, this function will return the highlighted code as a string, instead of printing it out. default is false.ReturnThe highlight_string() function returns true on success, or false on failure.ExampleThe following is an example that output a string with the PHP syntax highlighted. OutputThe following is the output.Hello world!
The parse_url and parse_str functions can be used to get the ID of a specific YouTube video.Example Live DemoOutputVX96I7PO8YUIn the above code, the parse_url function takes in a string and slices it into an array of information. The element that the user specifically wants to work with can be specified as a second argument or the entire array can be used.A YouTube video has an ID that can be seen in the URL. The goal is to fetch the ID after the letter ‘v’ and before ‘&’. To accomplish this, the parse_str function can be used. It is similar to GET ... Read More
The highlight_file() function outputs a file with the PHP syntax highlighted.Syntaxhighlight_file(file, return)Parametersfile − The file name to display.return − If this parameter is set to true, this function will return the highlighted code as a string, instead of printing it out. default is false.ReturnThe highlight_file() function returns the highlighted code as a string instead of printing it. Returns true on success, or false on failure, otherwise.ExampleThe following is an example, wherein we are using a test file ("new.php") to output the file with the PHP syntax highlighted. OutputThe output of the browser. ... Read More
To append 000, use the concept of ZEROFILL. Let us first create a table −mysql> create table DemoTable1913 ( Code int(4) ZEROFILL AUTO_INCREMENT NOT NULL, PRIMARY KEY(Code) ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1913 values(1); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1913 values(2); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1913 values(3); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1913 values(4); Query OK, 1 row affected (0.00 sec)Display all records from the table ... Read More
The resultant value of var_dumo can be extracted to a string using ‘output buffering’. Below is an example demonstrating the same −Example Live Demo
The get_browser() function looks up the user's browscap.ini file and returns the capabilities of the user's browser.Syntaxget_browser(user, return_array)Parametersuser − The name of HTTP user agent.return_array − If this parameter is set to true, the function will return an array instead of an object.ReturnThe get_browser() function returns object or array with information about browser of user.ExampleNote − The result will vary system to system.ExampleOutputThe following is the output.Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/70.0.3538.110 Safari/537.36
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP