Sqlsrv function problem ms SQL sqlsrv PHP5.3.5
Environment: Apache 2.2.22, PHP 5.3.5, and database MSSQL2008
Mssql is a version earlier than PHP5.3. how can I change the following code to a version later than PHP5.3, that is, the sqlsrv function? I tried to change some of the code, but I always reported an error. I can only ask for help here !!
$ PageCnt) {$ CurrentPage = $ PageCnt;} // set the starting page number $ Start = $ CurrentPage-3; // Set the ending page number $ End = $ CurrentPage + 3; // Previous Page $ PrvPage = $ CurrentPage-1; // Next Page $ NextPage = $ CurrentPage + 1; if ($ Start <1) {$ Start = 1; $ End = $ Start + 6;} if ($ End> $ PageCnt) {$ Start = $ PageCnt-6; $ End = $ PageCnt;} if ($ sqlstr! = "") {$ Sqlstr = "select top ". $ PageSize. "mName, mSex, mBirthday, mTel, mAddress, tname from myfriends, team where myfriends. tid = team. tid and mid not in (select top ". ($ CurrentPage-1) * $ PageSize. "mid from myfriends) and ". $ sqlstr;} else {$ sqlstr = "select top ". $ PageSize. "mName, mSex, mBirthday, mTel, mAddress, tname from myfriends, team where myfriends. tid = team. tid and mid not in (select top ". ($ CurrentPage-1) * $ Pag ESize. "mid from myfriends)" ;}// echo $ sqlstr; $ result = mssql_query ($ sqlstr ); // return result set/* mssql_fetch_row // Retrieve row data mssql_fetch_field // Retrieve column data */?>
Reply to discussion (solution)
Generally, you can replace mssql with sqlsrc, but pay attention to the location and meaning of each parameter.
Some functions are not available, such as sqlsrv_fetch_row corresponding to mssql_fetch_row, which is replaced by sqlsrv_fetch_array/sqlsrv_fetch_objec.
Please refer to the manual for details.
Generally, you can replace mssql with sqlsrc, but pay attention to the location and meaning of each parameter.
Some functions are not available, such as sqlsrv_fetch_row corresponding to mssql_fetch_row, which is replaced by sqlsrv_fetch_array/sqlsrv_fetch_objec.
Please refer to the manual for details.
Can I provide a reference to this manual? I have downloaded a lot of PHP manuals online, and I don't have this function (sqlsrv)
Http://www.php.net/manual/zh/book.sqlsrv.php
Http://php.net/manual/zh/book.sqlsrv.php