Swagy Posted July 9, 2017 Posted July 9, 2017 <?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.
Moderators Citizen Posted July 9, 2017 Moderators Posted July 9, 2017 Please provide any error coming from debugscript 3 and debugdb 2. Also make sure your script is loaded as a server script (check your meta.xml). I'm asking that because you are using executeSQLQuery (serverside only) alongside with onClientGUIClick (clientside only).
Swagy Posted July 9, 2017 Author Posted July 9, 2017 @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 Citizen Posted July 9, 2017 Moderators Posted July 9, 2017 You forgot to put the username and password for the connection: $mtaServer = new mta( $hostname, $port, $username, $password );
Swagy Posted July 9, 2017 Author Posted July 9, 2017 @CitizenStill the same, I changed it, I think it's fomr this line $returns[] = $resource->call("addUpdate",...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now