SQL Server Developer Center > SQL Server Forums > SQL Server Driver for PHP > fatal error undefined function sql_num_rows already have 1.1 driver also added cursor by examples??????
Ask a questionAsk a question
 

Answerfatal error undefined function sql_num_rows already have 1.1 driver also added cursor by examples??????

  • Saturday, October 17, 2009 5:09 AMbillspeg Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I get basic queries to run but this page i am on now has multiple queries and for s&g i want to make it work.
    i keep running across this sqlsrv_num_rows fatal error Undefined function but i can connect and run queries the code involved is below
    $getUser = $loginConnector->query("SELECT * FROM cmsusers WHERE user = '".$_SESSION['user']."' AND pass = '".$_SESSION['pass']."' AND thegroup <= '".$group."' AND enabled = 1",array(),array("Scrollable"=>SQLSRV_CURSOR_KEYSET));

       if ($loginConnector->getNumRows($getUser) > 0){
        // Existing user ok, continue
        if ($goodRedirect != '') {
         header("Location: ".$goodRedirect."?".strip_tags(session_id())) ;
        }   
        return true;
       }else{
        // Existing user not ok, logout
        $this->logout();
        return false;
       }

    getNumRows() is from an include DbConnector Class the function follows

    function getNumRows($result){
     return sqlsvr_num_rows($result);
    }

Answers

All Replies

  • Monday, October 19, 2009 8:11 PMSerban Iliescu - MSFTAnswererUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Proposed Answer

    Please check the API syntax The API is defined as sqlsrv_num_rows() and not as sqlsvr_num_rows().

     

    Thank you,

    Serban

     


    Serban Iliescu - MSFT
  • Tuesday, October 20, 2009 1:31 AMbillspeg Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    i know the code is not recommended i plan on parameterizing it later. the system i am on is windows 2008 webserver x64 x64 version of sql express 2008.
    ver 5.2 of php zend community edition which reports driver loaded. ver 5.2 non thread driver 1.1. handler is mapped to php-cgi.exe.

    where can i find better log info php doesn't write to the syslog as promised in php.ini the php log just reports the same error i get on screen.
     you already commented to someone else about that php not finding the driver.  this happens with sqlsrv_num_rows and sqlsrv_has_rows It is like i am using your ver 1.0 driver that doesn't have the feature but it is absolutely ver 1.1 of the driver.

  • Tuesday, October 20, 2009 3:29 PMSerban Iliescu - MSFTAnswererUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    I was trying to draw your attention to the fact the “sqlsvr_num_rows()” does not exist. Please use in your code “sqlsrv” instead of “sqlsvr”.


    Serban Iliescu - MSFT
  • Wednesday, October 21, 2009 12:22 PMbillspeg Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    You fixed it thank you serban my typo my mistake sorry!!