Jump to content


New Members
  • Posts

  • Joined

  • Last visited

Popdog's Achievements


Newbie (1/5)



  1. OMG, you found it! I have to run next result 4 times before I get my output. The SP has multiple select statements into temporary tables but this has never caused any additional outputs when accessed from other methods.
  2. The loop is not being run at all. I guess because there is no rows. var_dump(sqlsrv_num_rows($stmt)); outputs "Bool(False)" var_dump(sqlsrv_next_result($stmt)); outputs "Bool(True)" The "Statement Executed" echo is always working. Just no further echos afterwards. There is no other code other than the Variable population for credentials and cleanup. If I change only the stored procedure name to another SP in the database, the webpage outputs the first row without any issue. I have the following at the top of the code also now. error_reporting(E_ALL); ini_set('display_errors', '1');
  3. I test this out with no luck. I would expect that all stored procedure calls would require this if that was the case though. I can call any other stored procedure without a problem, it is just this one procedure that returns no rows. I would normally expect the procedure is bad, but it is not bad, it returns a row every time I test it. That is where I am baffled. It is tough for me to post the procedure on a SQL forum for help when it works perfectly fine. It is as if though the way the procedure is returning the data is somehow hiding it. Here is my vbscript app that works just fine calling the same exact SP. strSQL = "exec GetBalanceForBalanceSite "&chr(34)&"5404"&chr(34) conn.Open ConnectionDetails rs.open strSQL, conn, 3,3 If NOT rs.EOF Then rs.MoveFirst MsgBox rs("Balance") End If
  4. Ok, I tried this just to make sure but for this stored proc it is not a requirement. Both "exec GetBalanceForBalanceSite '1008'" and "exec GetBalanceForBalanceSite @scid=1008" return the same output. 1 row from studio and 0 rows from PHP
  5. That is exactly the issue. It appears as if though no rows are being returned but only when called using a PHP or Javascript app. No errors are returned when turning on error checking. It just sees no data. In Microsoft Studio it does return a row using the exact same statement though. Also when I call it using an ADODB connection in VB it returns data just fine. I can't understand how this method could see a different result than any other method of running the same exact statement?
  6. I have a stored procedure that simply returns 1 result and only 1 row. The output when run through studio looks like the attached image. I have written local VB applications that execute the stored procedure and output the data on screen without issue. But when I use the below PHP app it acts as if though the stored procedure did not return any rows. All I get on the screen is the "Statement Executed" echo. Now other stored procedures work fine when I use this same code, but I know this SP is returning a row with a value (see attached screenshot) in it, so I can't understand why PHP would see only this SP as not returning a value. $connectionInfo = array( "UID"=>$uid, "PWD"=>$pwd, "Database"=>$databaseName); /* Connect using SQL Server Authentication. */ $conn = sqlsrv_connect( $serverName, $connectionInfo); $tsql = "Exec GetBalanceForBalanceSite '1008'"; /* Execute the query. */ $stmt = sqlsrv_query( $conn, $tsql); if ( $stmt ) { echo "Statement executed.<br>\n"; } else { echo "Error in statement execution.\n"; die( print_r( sqlsrv_errors(), true)); } /* Iterate through the result set printing a row of data upon each iteration.*/ while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC)) { echo $row[0]; }
  • 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.