SA-MP Forums Archive
HTML/UCP Coding Help! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: HTML/UCP Coding Help! (/showthread.php?tid=609292)



HTML/UCP Coding Help! - Jigsaw123 - 10.06.2016

Hey guys! I ran my UCP, and on one of the pages it gives me this error:

Код:
Strict Standards: Non-static method utils::startsWith() should not be called statically in /home/fcrolepl/public_html/fortcarson-rp.com/ucp/resources/usrfuncs.class.php
This is line 138 in usrfuncs.class.php:

Код:
	if (utils::startsWith($data['gender'], "m")) {
	    $gender = "Male";
	} else {
	    $gender = "Female";
	}



Re: HTML/UCP Coding Help! - Vince - 10.06.2016

This isn't a PHP help forum. Regardless: the error says that you shouldn't call the startsWith method in the utils class with the scope resolution operator (the double colon); you must first instantiate the utils class and then call the method on that instance, i.e.:
PHP код:
$utilsInstance = new utils();
if(
$utilsInstance->startsWith($data['gender'], "m"))
{
    
// ...

Or make the startsWith method static in the utils class.

PHP код:
public static function startsWith(/* ... */



Re: HTML/UCP Coding Help! - Jigsaw123 - 10.06.2016

@Vince - Works Dad, thanks!.. +REP