login using stored procedures

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]<?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’);
}

?>[/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

You need to make use of concatenation. Change this line:

[php]$login = mysql_query(‘CALL sp_loginApplication($_POST[‘username’], $_POST[‘password’], $loginResult, $idinstitution, $nameinstitution, $userprofile)’);[/php]

to:
[php]$login = mysql_query(‘CALL sp_loginApplication(’.$_POST[‘username’].’,’.$_POST[‘password’].’, $loginResult, $idinstitution, $nameinstitution, $userprofile)’);[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service