Forums

This topic is locked

Logout user & update table at the same time ?

Posted 31 Jan 2007 00:41:13
1
has voted
31 Jan 2007 00:41:13 rob hewitt posted:
i'm trying to insert a record into a table when a member logs in & out.

in the login script i've inserted the following code just after session variables are declared to add a record to memberslogin table as follows :

$insertSQL = sprintf("INSERT INTO memberlogin (Email, direction, referred) VALUES (%s, %s, %s)",
GetSQLValueString($loginUsername, "text",
GetSQLValueString("IN", "text",
GetSQLValueString($_SERVER['PHP_SELF'], "text");

mysql_select_db($database_dancingin, $dancingin);
$Result1 = mysql_query($insertSQL, $dancingin) or die(mysql_error());

This works fine & memberslogin table records when the user logs in.

i tried adding the same thing at the beginning of the logout script, just replacing "IN" with "OUT" to record when they log out but whenever i try to logout, i get the following error:

Fatal error: Call to undefined function GetSQLValueString() in C:\Web\xampp\htdocs\new\index.php on line 17

Line 17 is GetSQLValueString($_SESSION['MM_Username'], "text",

Any ideas ?

Replies

Replied 31 Jan 2007 20:02:59
31 Jan 2007 20:02:59 Alan C replied:
I have noticed that sometimes DW tests for existence of that function, like this . . .

if (!function_exists("GetSQLValueString") {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = ""
{

....
.....
}

the error message is saying that the function is not defined so if you check whether or not it exists then define it if necessary that may work around the issue.
Replied 31 Jan 2007 20:46:41
31 Jan 2007 20:46:41 rob hewitt replied:
Worked a treat !!!

I copied the script into the beginning of the logout script & it worked perfectly...

thank you very much.
Replied 31 Jan 2007 22:58:38
31 Jan 2007 22:58:38 Alan C replied:
Great!

Thanks for responding too.

Reply to this topic