using msMSL and stored Procedures (EXEC)

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Hi all

I am trying to get the following to work

    $startPidpoint = $_REQUEST["startPidpoint"];
    $endPidpoint = $_REQUEST["endPidpoint"];
    $connectionstring = odbc_connect('DB','user','password');
    $stmt = odbc_prepare($connectionstring, 'EXEC getHistoryLocation ?
    $result =

    header("Expires: Mon, 3 Jan 2000 08:00:00 GMT");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    header("Cache-Control: no-store, no-cache, must-revalidate");
    header("Cache-Control: post-check=0, pre-check=0", false);
    header("Pragma: no-cache");
    echo "<locations>";
    while (odbc_fetch_row($stmt)) {
        $pidpoint = odbc_result($stmt,"pid");
        $Latitude = odbc_result($stmt,"latitude");
        $Longitude = odbc_result($stmt,"longitude");
        $Speed = odbc_result($stmt,"speed");
        $Angle = odbc_result($stmt,"angle");
        echo '  <location id="'.$pidpoint.'" lat="'.$Latitude.'"
lng="'.$Longitude.'" speed="'.$Speed.'" angle="'.$Angle.'"/>';
    echo "</locations>";


I think I have two problems,

1. Is the syntax for the "odbc_prepare" correct? Given this is a msSQL
2. odbc_execute returns a bool, so I can't use $result, but the $stmt
is a resource so I should be able to use the "odbc_fetch_row" but it's
not working.

Can anyone see what I am doing wrong.



Site Timeline