Set the Result of a Query to a Variable in MySQL

Chandu yadav
Updated on 29-Jun-2020 09:10:38

404 Views

You can set the result of a query using select into command. The syntax is as follows.select yourColumnName1 into @anyVariableName from yourTableName where yourColumnName2='anyValue';Check the result is present in the variable or not using the select command. The syntax is as follows -select @anyVariableName;To understand the above syntax, let us first create a table. The query to create a table is as follows.mysql> create table StudentInformation -> ( -> StudentId int, -> StudentName varchar(100), -> StudentAge int -> ); Query OK, 0 rows affected (0.62 sec)Insert some records in the table using insert command. The query is as follows.mysql> insert ... Read More

PHP log10 Function

Malhar Lathkar
Updated on 29-Jun-2020 09:10:34

189 Views

Definition and UsageThe log10 () function calculates base-10 logarithm of a number.Base-10 logarithm is also called common or sandard algorithm. The log10(x) function calculates log10x. It is related to natural algorithm by following equation −log10x=logex/loge10 So thatlog10100=loge100/loge10 = 2In PHP, log10 is represented by log10() functionSyntaxlog10 ( float $arg ) : floatParametersSr.NoParameter & Description1argThe number whose base-10 logarithm is to be calculatedReturn ValuesPHP log10() function returns base-10 logarithm of arg.PHP VersionThis function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.Example Live DemoFollowing example calculates base-10 logarithm of 100OutputThis will produce following result −log10(100)=2Example Live DemoFollowing code calculates base-10 logarithm of ... Read More

PHP log1p Function

Malhar Lathkar
Updated on 29-Jun-2020 09:09:22

144 Views

Definition and UsageHere 1p stands for 1 plus. The log1p () function calculates natural (base-e) logarithm of a 1+number.log1p(x)=log(1+x).log1p is calculated in a way such that its value is accurate even for very small x such that 1+x is nearly equal to xSyntaxlog1p ( float $arg ) : floatParametersSr.NoParameter & Description1argThe number whose 1p logarithm is to be calculatedReturn ValuesPHP log1p() function returns base-1p logarithm of arg+1.PHP VersionThis function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.Example Live DemoFollowing example calculates log1p of 100OutputThis will produce following result −using log() to calculate log(1+100)=4.6151205168413 log1p(100)=4.6151205168413Example Live Demowhere normal log(0) returns ... Read More

PHP log() Function

Malhar Lathkar
Updated on 29-Jun-2020 09:08:16

312 Views

Definition and UsageThe log () function calculates natural logarithm of a number.Logarithm is inverse of eponential. If 102=100, it means log10100=2. Natural logarithm is calculated with Euler Number e as base. In PHP, the predefined constant M_E gives value of e which is 2.7182818284590452354For example, exp(4.60517018599)=100 (it is also same as e4.60517018599=100). Hence, loge100=4.60517018599In PHP, loge is represented by log() functionSyntaxlog ( float $arg [, float $base = M_E ] ) : float ParametersSr.NoParameter & Description1argThe value whose logarithm is to be calculated2baseDefault value of base is M_E.Return ValuesPHP log() function returns logarithm of arg to base. If base is not given, result is ... Read More

MySQL Select Multiple Values

Rishi Rathor
Updated on 29-Jun-2020 09:07:55

22K+ Views

To select multiple values, you can use where clause with OR and IN operator.The syntax is as follows −Case 1 − Using ORselect *from yourTablename where yourColumnName = value1 or yourColumnName = value2 or yourColumnName = value3, .........N;Case 2 − Using INselect *from yourTableName where yourColumnName IN(value1, value2, ....N);To understand the above syntax, let us create a table. The following is the query to create a table −mysql> create table selectMultipleValues −> ( −> BookId int, −> BookName varchar(200) −> ); Query OK, 0 rows affected (1.68 sec)Now you can insert some records in the table with the help of ... Read More

PHP lcg_value() Function

Malhar Lathkar
Updated on 29-Jun-2020 09:06:34

207 Views

Definition and UsageThe lcg_value() function generates a random number between 0 and 1.LCG stands for linear congruential generator. This generator generates a sequence of pseudo-randomized numbers calculated with a discontinuous piecewise linear equation. This is one of the oldest pseudorandom number generator algorithmsSyntaxlcg_value ( void ) : floatParametersReturn ValuesPHP lcg_value() function returns a pseudo random float value between 0.0 and 1.0, inclusive.PHP VersionThis function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.Example Live DemoFollowing is the example use of lcg_value() function −OutputThis may produce following result −lcg_value() = 0.45920201711279 lcg_value() = 0.18118693614628

HTML Big Tag

Chandu yadav
Updated on 29-Jun-2020 09:06:21

142 Views

The element in HTML is used to form the text bigger than the default.Note: The element is not supported in HTML Let us now see an example to implement the element in HTML−Example Live Demo    Demo Heading    This is demo text!    This demo text is bigger than the default text. OutputIn the above example, first we have set a normal text −This is demo text!After that, we have set another text using the element −           This demo text is bigger than the default text.    

PHP is_nan() Function

Malhar Lathkar
Updated on 29-Jun-2020 09:05:16

913 Views

Definition and UsageNAN stands for "Not A Number". The is_nan() function checks whether its argument is not a number.Syntaxis_nan ( float $val ) : bool ParametersSr.NoParameter & Description1valThe value to be verified if infinite or notReturn ValuesPHP is_nan() function returns TRUE if val is "not a number", otherwise it returns FALSE.PHP VersionThis function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.Example Live DemoFollowing example shows that 100 qualifies as NANOutputThis will produce following result −int(100) bool(false)Example Live DemoValue of log(0) is infinity. Following example verifies if it is NAN −OutputThis will produce following result −float(-INF) bool(false)Example Live DemoSince cos(x) ... Read More

HTML Button Autofocus Attribute

George John
Updated on 29-Jun-2020 09:05:05

279 Views

The autofocus attribute of the element is used to set focus to the button whenever page loads.Following is the syntax −Above, we have set autofocus to a button. Let us now see an example to implement the autofocus attribute of the element −Example Live Demo    Demo Heading    This is a demo line.    Demo OutputThis will produce the following output displaying the focus is on button 1 −In the above example, we have set the autofocus attribute for the button element −    Demo Now, when the page loads, the focus would be on ... Read More

PHP is Infinite Function

Malhar Lathkar
Updated on 29-Jun-2020 09:03:58

277 Views

Definition and UsageThe is_infinite() function returns a boolean value. It checks whether given parameter is an infinnite number and if so the function returns TRUE, otherwise FALSE. A number is treated as infinite if it is beyond acceptable range of float in PHP.Syntaxis_infinite ( float $val ) : bool ParametersSr.NoParameter & Description1valThe value to be verified if infinite or notReturn ValuesPHP is_infinite() function returns TRUE if val is outside accepted range of float, otherwise it returns FALSE.PHP VersionThis function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.Example Live DemoFollowing example shows that 100 is not an ... Read More

Advertisements