Jump to content

[HELP] PHP SDK


Swagy

Recommended Posts

Posted
<?php
require "mta_sdk.php"; 

$mtaServer = new mta( '137.74.164.56', 22006);
$resource = $mtaServer->getResource ( 'UDCupdates', $mtaServer );
$returns[] = $resource->call('addUpdate', $_POST['name'], $_POST['dev']);

?>

ok I use this in the PHP file, don't mind the HTML file since it works fine, now I'll show you my MTA script

 

local sql = executeSQLQuery

function createTables ()

	sql("CREATE TABLE IF NOT EXISTS updates (update TEXT, developer TEXT, date TIMESTAMP DEFAULT CURRENT_TIMESTAMP)")
end
addEventHandler("onClientGUIClick", root, createTables)

function addUpdate (text, dev)

	if (text) then
		if (dev) then
			sql("INSERT INTO updates (update, developer) VALUES (?,?)", text, dev)
			outputChatBox("[Updates] "..text.." ("..dev..")",root,255,130,4)
			return true
		else
			return false
		end
	else
		return false
	end
end

 

resource is started and export is added, but the problem is call function in PHP, help please.

Posted

@Citizen

the problem is from the PHP file here is what I get

 

Erreur interne du serveur

 

and the function isn't called.. and everything is fine

so @Citizen can you figure out the problem?

  • Moderators
Posted

You forgot to put the username and password for the connection:

$mtaServer = new mta( $hostname, $port, $username, $password );

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...