[HELP] PHP Call to Undefined Function

Status
Not open for further replies.

Adonn

New Member
Mar 25, 2011
27
4
Hello everybody, I have a PHP script that I found on the interwebz that allows socket connections through it ... After a bit of tweaking, I finally got the login and register system completely working for Habbo's v1 client ... However, I am running into a bit of a problem with function calls ...

The script calls a function to check the last time they were online ( getLastTime() ) ... With a specified username as the only parameter in this function, I can use it to draw the last time a user was online.

The script, when calling this function returns an error ( PHP Fatal error: Call to undefined function getLastTime() )

What's strange is that this function exists in the script.

If anybody has any advice, please reply, it would be greatly appreciated.
 

X1M!

le troller
Jan 6, 2011
179
1
Have you checked that the script is properly included (if in a external file) and is written with the correct case? (Maybe its like GetLastTime() or something)
 

Adonn

New Member
Mar 25, 2011
27
4
Yes, the function and the call to it are in the same case, and the whole script is in the same file (with the function being before the call)
 

Adonn

New Member
Mar 25, 2011
27
4
I can post the function and where its calling it, but as of now, I dont want to post the entire script

Heres the function:
PHP:
function getLastTime($username) {
	$mysqlquery = "SELECT `on_time` FROM `users` WHERE `id` = " . mysql_real_escape_string($username) . " LIMIT 1;";
	$mysqlresult = mysql_query($mysqlquery);
	if(!mysql_num_rows($mysqlresult)) return false;
	$row = mysql_fetch_assoc($mysqlresult);
	return $row["on_time"];
}

And where its being called:
PHP:
sendData($i, "MEMBERINFO MESSENGER\n" . $buffer . "\n" . getMSG($buffer) . "\n" . getLastTime($buffer) . "\n" . isOnline($buffer) . "\n" . getFigure($buffer) . "\n" . getSex($buffer));

The $buffer variable correctly parses the username, so that cant be the problem
 

Kryptos

prjRev.com
Jul 21, 2010
2,205
1,252
You can just do
PHP:
$query = "SELECT 'on_time' FROM users WHERE id = "$id'";
return mysql_result(mysql_query($query), 0);
You can do row['on_time'] because you're only calling on time from the database, so it would just be $row.
If it was * instead of 'on_time' then you would have to use $row['on_time'].
see if it helps.
 
Status
Not open for further replies.

Users who are viewing this thread

Top