I'm trying to retrieve values of out parameter by using ODBC and PHP. I've been searching online but to no avail. There are a lot of resolves for PDO and mysqli and I only found this for odbc. I'm kind of lost by the parameter and the operation involve.
Is there any documentation or reference that I can follow? Anyone have any idea on how can I retrieve the data?
This is my code, I'm able to make the connection to the database but the Error in SQL always pops up. I couldn't figure them out.
Is there any documentation or reference that I can follow? Anyone have any idea on how can I retrieve the data?
This is my code, I'm able to make the connection to the database but the Error in SQL always pops up. I couldn't figure them out.
Code:
<?php
$conn=odbc_connect("dsn", " ", " ");
$result=odbc_exec($conn,"CALL ndTblUser (@varUserId,@varUserPwd)");
if (!$conn){
exit("Connection Failed: " . $conn);
}
$sql="CALL ndTblUser (@varUserId,@varUserPwd)";
$stmt=odbc_exec($conn, $sql, "SELECT @varUserId as $UserId, @varUserPwd as $UserPwd)");
$rs=odbc_exec($conn,$stmt);
if (!$rs) {
exit("Error in SQL");
}
echo "<table><tr>";
echo "<th>Id</th>";
echo "<th>Password</th></tr>";
while (odbc_fetch_row($rs)) {
$UserId=odbc_result($rs,"UserId");
$UserPwd=odbc_result($rs,"UserPwd");
echo "<tr><td>$UserId</td>";
echo "<td>$UserPwd</td></tr>";
}
odbc_close($conn);
?>