Jump to content

sunilvadranapu

Members
  • Posts

    72
  • Joined

  • Last visited

    Never

Posts posted by sunilvadranapu

  1.  

    thanks for your reply. my problem is, I have designed a form which takes data like name, contact number, e-mail etc from users. if users enter wrong e-mail and submit the form, it validates the form data and gives "back" link to correct wrongly entered data.

    Incorrect e-Mail address. Please go <a href="javascript:history.back();">back</a> and enter the e-Mail address correctly
    

     

    when i click the "back" link, all of the form data was gone. how can i make retain the form data when clicked the back link.

     

    data is retained when going through browser's back button. but not with javascript:history.back method

     

    any ides??

     

     

    thanks again.

  2.  

    My intension is to write a PHP class for handling errors. thats why i am developing the "Error" class which has a constructor in which i am setting up the user defined error handler and a "ErrorHandler" method which handles all errors encountered while execution.

     

    please help me in this regard

     

     

    thanks in advance

  3.  

    This is my actual class:

     

    
    <?php
    class Error
    {
    
        function __construct (){
        {
    	if (error_reporting() == 0)
    		return;
    
    	//set_error_handler(array($this,"ErrorHandler"));
    	set_error_handler("ErrorHandler");
        }
      
        function ErrorHandler($errno,$errstr,$errfile,$errline)
        {
    
    	$errorType = array (
    		   E_ERROR          => 'ERROR',
    		   E_WARNING        => 'WARNING',
    		   E_PARSE          => 'PARSING ERROR',
    		   E_NOTICE         => 'NOTICE',
    		   E_CORE_ERROR     => 'CORE ERROR',
    		   E_CORE_WARNING   => 'CORE WARNING',
    		   E_COMPILE_ERROR  => 'COMPILE ERROR',
    		   E_COMPILE_WARNING => 'COMPILE WARNING',
    		   E_USER_ERROR     => 'USER ERROR',
    		   E_USER_WARNING   => 'USER WARNING',
    		   E_USER_NOTICE    => 'USER NOTICE',
    		   E_STRICT         => 'STRICT NOTICE',
    		   E_RECOVERABLE_ERROR  => 'RECOVERABLE ERROR'
    	);
    
    
    	$errtime=date("Y-m-d H:i:s (T)");
    	$err_message="An error occured on ".$errtime."\n";
    	$err_message .="Details are as follows\n";
    	$err_message .="Error Number : $errno\n";
    	$err_message .=$errstr."\nOccured in ".$errfile."\n";
    	$err_message .="On Line $errline \n\n";
    	$err_message .=str_repeat("-",50);
    	$err_message .="\n";
           
    }
    
    
    
    }  //class
    ?>	
    
    

  4. thanks for your reply.

     

    In my "Error" class i have constructor and ErrorHandler() method.

     

    Class: Error

        constructor

        ErrorHandler

     

    i changed the constructor code to set user defined error handler to Error Class method "ErrorHandler"

     

    set_error_handler("ErrorHandler");

     

    even then i am getting the warning msg:

     

    Warning: set_error_handler() expects the argument (ErrorHandler) to be a valid callback in C:\php_dev\errorHandler\sun_error.php on line 16

     

     

     

    thanks in advance

  5. Hi,

      I am writing a PHP class for custom error handling. In constructor i am setting up the error handler like this.

        function __construct (){
        {
    	if (error_reporting() == 0)
    		return;
    
    	$this->logger = new Logger("mylog.log","append") ;  //create object to logger class
    	set_error_handler(array($this,"ErrorHandler"));        //set user defined error handler
        }
    

     

    while running the i am getting below warning:

     

    Warning: set_error_handler() expects the argument (Error::ErrorHandler) to be a valid callback in C:\php_dev\errorHandler \sun_error.php on line 16

     

     

    what is this waring? can any one tell me how can i remove this warning??

     

    thanks in advance

     

     

    -sun

  6. Hi,

      I am planning to write a PHP class for handling Errors/Warnings using trigger_error function.  Could any one explain what happens the below line gets executed?

     

        trigger_error("SQL:Non Timeout Error", E_USER_NOTICE);

     

    I know we can process it using our own error handler with set_error_handler(). but  if didn't set user defined handler, what happens then? will it reporterror??

     

     

    thanks in advance

     

     

    -sun

  7. Hi, 

      does any one know how to build PHP with DataDirect Driver and Custom ODBC? from where i can get DataDirect Driver manager?

     

    presently i build PHP on Linux as:

          ./configure –-enable-ftp –-enable-so –enable-soap –-with-apxs2 -with-custom-odbc=/usr/odbc

     

    what is the flag i need to set for DataDirect Driver Manager?

     

    Thanks in advance.

     

     

    -sunil

  8. Hi,

    thanks for your reply. Is there any other way to access the web service on different domain. i tried to access with "xmlhttprequest", but even then getting same problem

    var xmlhttp;
    function validateIPAddress1(sysName)
    {
        url="http://sunil/misc/misc.asmx/isIP?IPaddress=" +sysName;
        xmlhttp=null;
        if (window.XMLHttpRequest)
        {
            xmlhttp=new XMLHttpRequest();
        }
        else if (window.ActiveXObject)
        {                      // code for IE5 and IE6
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        if (xmlhttp!=null)
        {
          xmlhttp.open("GET",url,true);
          xmlhttp.onreadystatechange=function() {
              if (xmlhttp.readyState==4) {
            
              var myXml = xmlhttp.responseXML;
              var xmlobject = null;
              var XMLText = null;
              if (window.ActiveXObject)
              {
                XMLText = myXml.childNodes[1].firstChild.nodeValue;
                alert(XMLText);
              }
              else
              {
                XMLText = myXml.childNodes[0].firstChild.nodeValue;
                alert(XMLText);
              }
            }
          }
          xmlhttp.send(null);
        }
        else
        {
            alert("Your browser does not support XMLHTTP.");
        }
    }

     

    any suggestions???

     

    thanks in advance

     

     

    -sunil

  9. Hi,

      I have designed a form with text box for reading IP address and onChange method of textbox i am calling a  javascript function to validate IP address entered in the textbox.

      In java script function, i am  invoking a web service developed in C# which is on different domain. when i am running this page getting the warning message "This page is accessing information that is not under its control. This poses a security risk. Do you want to continue?"

     

      my java script function is:

    <CODE> 

    function validateIPAddress(sysName)

    {

      var ret;

      var QueryString = "http://sunil/misc/misc.asmx/isIP?IPaddress=" +sysName;

     

      var xmldoc=new ActiveXObject("Microsoft.XMLDOM");

      xmldoc.async = false;

      xmldoc.load(QueryString);

      oNodeList = xmldoc.documentElement.childNodes;

     

      ret = oNodeList.item(0).text;

      if( ret == "BAD_ADDRESS")

    return false;

      else

    return true;

    }

    </CODE>

     

     

    Could any one shed some light on this.

     

    Thanks in advance

     

     

    -sun

  10. Hi,

      in order to connect to DB with DSN-less connection, do we  need to do any configuration changes  in php.ini? also please let me know what are the configuration generally we do in php.ini

     

    thanks in advance.

     

    -sunil

     

  11. Hi,

      I have developed one PHP class- DBConnection to connect Database and another class-Logger for logging the information like connection success or failure and event information. Now how can i access WriteLog method of Logger class in connect() method of DBConnection Class. Can you give me sample code for this.

     

    Thanks in advance

     

    --Sunil

     

  12. I am able to connect to Teradata using DSNless connection in windows but failing in Linux.

    my code is


      function ConnectDB($host, $username, $password, $options="") {
    $con_string = "DRIVER={Teradata};DBCName=" . $host ."; DATABASE=DBC; RunInQuietMode=Yes";
            if (!($this->connection_id = @odbc_connect($con_string,$username,$password)) ){
                    $this->report_error("\nConnection Failed.....\n");
                      exit;
            }
            else {
                    echo "\nConnected to ". $host. " DB..."."\n";
                      return $this->connection_id;
            }

            }//end of connectDB
    [/Code]

     

    The above code is working fine in Windows but resulting below errors in Linux

      ODBC error: [DataDirect][ODBC lib] Invalid string or buffer length

      ODBC error code: S1090

     

    I think we can use odbc_connect() function for both DSN and DSNless connections. As per my knowledge,

    odbc_connect() when used with DSN connection, calls SQLConnect(). But when used with DSNless connection calls SQLDriverConnect(). 

     

    But when i checked my driverTrace, i observed that odbc_connect in linux calling SQLConnect() eventhough i am passing DSNless connection string.

     

    could any one help in this regard.

     

    thanks in advance

     

    -sunil

  13. Hi,

      did any one know how to connect to teradata from PHP with dsn less connection.

      I am getting error while trying with below code -

          ODBC error: [DataDirect][ODBC lib] Invalid string or buffer length

          ODBC error code: S1090

     

    Code:

    <?php

    $con_string = "DRIVER={Teradata};DBCName=sunil; DATABASE=DBC;

     

    if (!($this->connection_id = @odbc_connect( $con_string, ****, *****)) ){

            echo "Connection Failed");

    }

    else {

            echo "Connected to DB..."."\n";

    }

     

    ?>

     

    Can any one tell me whats the problem in this code.

     

    thanks in advance

     

    -sun

     

  14. Hi,

      I want to write a class for database connection to mySQL. could any one help in sharing their ideas:

      my class is like this:

     

      variables:

     

    Host                DB servername

    Database          DB name

    User                  DB username

    Password          DB password

    Connection_id    holds the connection state(fail/success)

    Errno 

    ErrorString

     

    Functions:

    ConnectDB ();     

    queryDB();

    fetchResult();

    totRows();

    conClose();

     

    am i need to add any more methods

     

  15. Hi,

      I am trying to install PHP on MPRAS OS (UNIX_SV  4.2 3.3 NCR_PE_016D Pentium IV-ISA/PCI) systsem. I run the configuration with ftp enable successfully. but when i run them "make", i am getting below error. Could any one help in solving this problem:

     

    sunil:/home/sun/php-5.1.2 > make

            /bin/sh /home/sun/php-5.1.2/libtool --silent --preserve-dup-deps --mode=compile gcc -Iext/date/lib -Iext/date/ -I/home/sun/php-5.1.2/ext/date/ -DPHP_ATOM_INC -I/home/sun/php-5.1.2/include -I/home/sun/php-5.1.2/main -I/home/sun/php-5.1.2 -I/usr/local/include/libxml2 -I/home/sun/php-5.1.2/ext/date/lib -I/home/sun/php-5.1.2/TSRM -I/home/sun/php-5.1.2/Zend    -I/usr/include -g -O2  -c /home/sun/php-5.1.2/ext/date/lib/parse_date.c -o ext/date/lib/parse_date.lo

     

    cc1: out of memory allocating 36175296 bytes after a total of 2392064 bytes

    *** Error code 1 (bu21)

     

    make: fatal error.

     

    Thanks in advance

     

    -sun

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.