Tuesday, May 1, 2018

PHP Oracle Database connection in Xamp

If you installed xamp for php programing and want to connect Oracle database as backend then you have to enable this. By default we did not get php oracle enabled.
PHP has OCI8 extention, which provide oracle connectivity to php application. OCI8 uses "oracle Instant Client" Package to get oracle specific function.

1. Download the "Instant client Package-Basic" for windows  from the OTN instant client page.



2. Unzip it to c:\instantClient_11_2

3. Now need to edit  System "Environment Variables". For this go to My computer property click on "Advance System Setting" and then Environment Variables. and add "C:\instantclient_11_2" to system variable PATH.


4. Restart Your computer.

5. Now find the below string in php.ini file.
;extension=php_oci8.dll
;extension=php_oci8_11.dll

remove semicolon( ;) to uncomment string.

6. Now Download the Actual Thread safe OCI-DLL from  https://pecl.php.net/package/oci8/2.0.8/windows
Download according to you php version. suppose your php version is 5.4, then download 5.4 Thread safe(TS) x86 zip file.


7. unzip OCI-DLL zip and and copy all files from this folder to Extention Directory of PHP C:\xampp\php\ext

8. Restart xamp Appache server.

9. To make sure that the connection to oracle database is successfully activated, go to phpinfo (http://localhost/dashboard/phpinfo.php). find string 'oci8' .If found, then xamp can communicate from Oracle database
Now we check connection using below PHP script :

<?php

$DB ="(DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.0.3)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = SERVICE_NAME)
    )
  )";
$conn=oci_connect('USERID','PASSWORD',$DB);

if(!$conn)
{
die('Could not connect: ' . oci_error());
}
else
{
 echo "Successfully";
}

?>


Sunday, March 18, 2018

Failed to establish connection to the server. kindly restart emsigner

//failed to establish connection to the server. restart emsigner
Step 1 : Check for latest java update
Step 2: Latest emsigner version
Step 3 : Open control panel and open Java and add https://127.0.0.1:1585 in security tab
Step 4 : Run below in cmd

netsh interface portproxy add v4tov4 listenport=1645 listenaddress=127.0.0.1 connectport=1585 connectaddress=127.0.0.1

Friday, October 27, 2017

The module vsflex7l.ocx failed to load in Windows10 64-bit computer

If you are getting error of The module vsflex7l.ocx failed to load  because it was put in the wrong folder. I assume most of you placed the .ocx in the System32 folder. But if you are using Vista and/or Win7 64-bit, the .ocx must be placed in the SysWOW64 folder instead, which, just so happens to be right next to the System32 folder.
Now follow the same instructions, but simply change to the corresponding path in the CMD.

1) Move vsflex7l.ocx to c:\Windows\SysWOW64
2) Open a command line window and run following command:
    regsvr32 c:\Windows\SysWOW64\vsflex7l.ocx
b) For Vista/Win7 users with UAC turn on, the above command needs to be run from elevated command prompt.
Once vsflex7l is registered successfully, following message will prompt: "DllRegisterServer in C:\WINDOWS\SysWOW64\vsflex7l.ocx succeeded."
Now launch the application again and you should not see the file missing error.

Monday, November 28, 2016

SQL First Date and Last date of current month

To get first date of current month use below sql query :

select  CAST(DATEADD(dd,-(DAY(getDate())-1),getDate()) as date) ,'First Date of current Month'
union
CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(DATEADD(mm,1,getDate()))),'Last day of Current month'

Monday, January 12, 2015

On button click webpage reload using javascript

In javascript, reload() function is used to reload web page. The reload() method does the same as the reload button in your browser.

 By default, the reload() method reloads from the cache, but by you can force the the reload to get the page from server by setting the forceGet parameter to true: location.reload(true).

example : <input type="button" onclick="location.reload()">

Sunday, October 5, 2014

PHP Fatal error: Call to undefined function session_register()

session_register() has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0.

Your facing this problem because of you are using PHP 5.4.0 or above

Read PHP documentation
http://www.php.net/manual/en/function.session-register.php


For solution : Remove  session_register() from you code.

Tuesday, August 12, 2014

Select data beween two row number of result set (LIMIT IN MSSQL)

In MYSQL, LIMIT  clause is used to select records from the beginning, middle and end of a result set.
The LIMIT clause accepts one or two arguments. The values of both arguments must be zero or positive integer constants.

Select * from Tablename LIMIT offset,count

Here offset specifies the offset of the first row to return and count specifies maximum number of rows to return.

But in MSSQL it can get different way. TOP Clause is used to specify the number of records to return.

SELECT TOP number|percent columnname(s)
FROM tablename


MSSQL SERVER Does not support LIMIT clause. You can implement it in different way. Suppose you want to select rows between 6 to 10, you should try below MSSQL query

SELECT * FROM (
  SELECT *, ROW_NUMBER() OVER (ORDER BY table_column) as row FROM Tablename
 ) a WHERE row > 5 and row <= 10