Hi all,
I have a table that looks like the following: https://postimg.org/image/nfnhfiivv/
When I press the view button, I want to start another page with a stored procedure in it that will bring me the extra data.
The stored proc requires the userName to pass as a parameter,
How would I take the username from the table and pass it in my stored procedure in another class?
Or if there is a better way to do it, how would I do that?
Any help, suggestions or guidance is very appreciated.
Here is my code for the stored Proc:
global $userName;
$sqlForUser = "SPgetUserDetails $userName" ;
$sqlForUser = sqlsrv_query ( $connection, $sqlForUser );
if( $sqlForUser )
{
echo " Connection to Stored Procedure Successful ";
}
else
{
echo " Failed to connect with Stored Procedure " ;
die ( print_r( sqlsrv_errors( ), true ) );
}
Actually you donāt call a stored procedure from a button, you use some code running on the server to get the information to the client. I would try using Ajax for this. See https://www.w3schools.com/php/php_ajax_php.asp
If you want to use $_POST, then use a different method when you call the server code. You donāt show how your button calls the server code, is it via a form, or is the button a styled href link? If the former, just change the method.