fogofogo Posted June 17, 2010 Share Posted June 17, 2010 Hello I' having problems called a mssql stored proc with the following code... $myServer = "SERVER"; $myUser = "USER"; $myPass = "PASS"; $myDB = "DB"; //connection to the database $dbhandle = mssql_connect($myServer, $myUser, $myPass) or die("Couldn't connect to SQL Server on $myServer"); //select a database to work with $selected = mssql_select_db($myDB, $dbhandle) or die("Couldn't open database $myDB"); // call my proc fromhere function loginUser($alias, $password) { $proc = mssql_init('sp_CheckUserExists',$selected); mssql_bind($proc,'@Alias',$alias,SQLVARCHAR); mssql_bind($proc,'@Password',$password,SQLVARCHAR); if ($result = mssql_execute($proc)) { if ($row = mssql_fetch_row($result)) { // action } } And here are the erros I am getting.... Warning: mssql_init(): supplied argument is not a valid MS SQL-Link resource in Functions.php on line 70 Warning: mssql_bind(): supplied argument is not a valid MS SQL-Statement resource in Functions.php on line 72 Warning: mssql_execute(): supplied argument is not a valid MS SQL-Statement resource in Functions.php on lin Anyone know what theses errors are? THanks! Quote Link to comment https://forums.phpfreaks.com/topic/205053-problems-with-stored-proc-mssql/ Share on other sites More sharing options...
trq Posted June 17, 2010 Share Posted June 17, 2010 You need to pass $dbhandle to mssql_init not $selected. Quote Link to comment https://forums.phpfreaks.com/topic/205053-problems-with-stored-proc-mssql/#findComment-1073402 Share on other sites More sharing options...
fogofogo Posted June 17, 2010 Author Share Posted June 17, 2010 I'm an idiot! thanks Quote Link to comment https://forums.phpfreaks.com/topic/205053-problems-with-stored-proc-mssql/#findComment-1073455 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.