Author Archives: Admin

Curl function not working in aps package/PA Server Why?

See the below example

curl_setopt($curl,CURLOPT_HTTPHEADER,array (“Accept:application/json”));
curl_setopt($curl, CURLOPT_POST, 1); // Do a regular HTTP POST
curl_setopt($curl, CURLOPT_POSTFIELDS, ‘client_id=’ . urlencode($client_id) . ‘&’ .
‘client_secret=’ . urlencode($client_secret) . ‘&’ .
‘grant_type=client_credentials’ . ‘&’ .
‘scope=openid’);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_USERAGENT, “Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)”);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_URL, $token_url);
$response = curl_exec($curl);

it is not whowing any response in PA server.

Note:This is because of space in the Post Data Please change the use the PSOT data without space as below

$inputdata=”client_id=”.urlencode($client_id).”&client_secret=”.urlencode($client_secret).”&grant_type=client_credentials&scope=openid”;
curl_setopt($curl, CURLOPT_POSTFIELDS, $inputdata); // Set POST data

This will be working fine after removing space.

Operators in the where clause

#Example for “=”.

select * from mydoubts_table_users where name=’vasanthan’

——————————————————
|id|Name |Age|
——————————————————
|1|vasanthan|32|
——————————————————-

#Example for “!=”

select * from mydoubts_table_users where name!=’vasanthan’

output
——
——————————————————
|id|Name |Age|
——————————————————
|2|John |44|
|3|Michael |34|
|4|Rani |39|
|5|Raina |38|
|6|Rajendra |25|
|7|Sharon |18|
——————————————————-

#Example for “>”

select * from mydoubts_table_users where age>29

output
——
——————————————————
|id|Name |Age|
——————————————————
|1|vasanthan|32|
|2|John |44|
|3|Michael |34|
|4|Rani |39|
|5|Raina |38|
——————————————————-

#Example for “<" select * from mydoubts_table_users where age<29 output ------ ------------------------------------------------------ |id|Name |Age| ------------------------------------------------------ |6|Rajendra |25| |7|Sharon |18| ------------------------------------------------------- #Example for ">=”

select * from mydoubts_table_users where age>=39

output
——
——————————————————
|id|Name |Age|
——————————————————
|2|John |44|
|4|Rani |39|
——————————————————-

#Example for “<=" select * from mydoubts_table_users where age<=32 output ------ ------------------------------------------------------ |id|Name |Age| ------------------------------------------------------ |1|vasanthan|32| |6|Rajendra |25| |7|Sharon |18| -------------------------------------------------------

Where query in mysql

Example:

select * from mydoubts_table_users where name=’vasanthan’

output
——
——————————————————
|id|Name |Age|
——————————————————
|1|vasanthan|32|
——————————————————-

Mysql ‘Select’ query

query example and sample output as below

“Select * from mydoubts_table_users

output
——
——————————————————
|id|Name |Age|
——————————————————
|1|vasanthan|32|
|2|John |44|
|3|Michael |34|
|4|Rani |39|
|5|Raina |38|
|6|Rajendra |25|
|7|Sharon |18|
——————————————————-

‘In’ clause in mysql

‘In’ clause wirll replace many ‘OR’s

Example for fetching data using ‘In’.

——————————————————
|id|Name |Age|
——————————————————
|1|vasanthan|32|
|2|John |44|
|3|Michael |34|
|4|Rani |39|
|5|Raina |38|
|6|Rajendra |25|
|7|Sharon |18|
——————————————————-

Select * from mydoubts_table_users where age IN(34,32,38);
——————————————————
|id|Name |Age|
——————————————————
|1|vasanthan|32|
|3|Michael |34|
|5|Raina |38|
——————————————————-

Suppose if we use the query using ‘or’ clause it will be like as below

Select * from mydoubts_table_users where age =34 or age=32 or age=38;