travisk Posted May 23, 2012 Share Posted May 23, 2012 Hi, I am rather rusty with my php coding and I am trying to create a login using a stored procedure with 2 in and 4 output variables. sp_LoginApplication. . with these ins and outs IN: p_userName VARCHAR p_userPassword VARCHAR OUT: p_result INT p_idIntitution INT p_nameInstitution VARCHAR p_userProfile INT Here is the code I have <?php // Inialize session session_start(); // Include database connection settings include('config.inc'); // Retrieve username and password from database according to user's input //$login = mysql_query("SELECT * FROM user WHERE (p_userName = '" . mysql_real_escape_string($_POST['username']) . "') and (p_userPassword = '" . mysql_real_escape_string(md5($_POST['password'])) . "')"); $login = mysql_query('CALL sp_loginApplication($_POST['username'], $_POST['password'], $loginResult, $idinstitution, $nameinstitution, $userprofile)'); // Check username and password match if (mysql_num_rows($login) == 1) { // Set username session variable $_SESSION['username'] = $_POST['username']; // Jump to secured page header('Location: securedpage.php'); } else { // Jump to login page header('Location: index.php'); } ?> I keep getting a Parse error: syntax error, unexpected T_STRING in /homepages/37/d89354651/htdocs/tek/test/Portal/examples/loginproc.php on line 11 Any help would be great. . . Thanks Quote Link to comment Share on other sites More sharing options...
Jessica Posted May 23, 2012 Share Posted May 23, 2012 If you didn't spot it before, the syntax highlighting provided by the forum should make it obvious. Quote Link to comment Share on other sites More sharing options...
smoseley Posted May 24, 2012 Share Posted May 24, 2012 Besides the single-quote issue, you're using the wrong function. What you want is mysql_execute: http://php.net/manual/en/function.mssql-execute.php Quote Link to comment Share on other sites More sharing options...
Jessica Posted May 24, 2012 Share Posted May 24, 2012 Besides the single-quote issue, you're using the wrong function. What you want is mysql_execute: http://php.net/manual/en/function.mssql-execute.php There is no mysql_execute, and I would think the OP knows if he's using mysql or mssql. Quote Link to comment 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.