Hi,
When I was trying to create an itemshop for our 4story server, I needed to create a function which returns the userID if we know the username (szUserID).
Code:
ALTER PROCEDURE [dbo].[TGetUserID2]
@szUserID varchar(50)
AS
BEGIN
DECLARE @szRes varchar(50)
SET @szRes= (Select dwUserID FROM TGLOBAL_GSP.dbo.TACCOUNT where szUserID=@szUserID);
print @szRes
END
will be the returned userID.
I need a little help, I would like to put this into PHP. I've tried two ways with no luck.
My code:.
PHP Code:
$_POST['Username'];
stores the username as we know
PHP Code:
<?php
require_once("config.php");
$connect = odbc_connect('Driver={SQL Server};Server='.$host.';', $user, $pass);
$sql = "Select dwUserID FROM TGLOBAL_GSP.dbo.TACCOUNT where szUserID='".$_POST['Username']."";
$r = odbc_exec($connect,$sql);
print $r
?>
But usually it returns
0, or that:
Code:
Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\php\PEAR\Config.php on line 80
Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\php\PEAR\Config.php on line 166
Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\php\PEAR\Config\Container.php on line 111
Resource id #9
Logout
.
Can I get some help?
By the way use my code & procedure as you want, it's free