So my goal is to post data to php so it can be stored in SQL and stuff like that. When I run the game on studio (yes httpservices are enabled) it does post and adds +1 columns on the table in phpmyadmin with SQL, but the data is empty and 'Rank' is 0.
I'm trying to get it to store the data sent from roblox correctly to SQL.
Here's what I've got so far...
The script in studio:
local httpServ = game:GetService("HttpService") sendData = '?Rank=1&Color=Really%20red&Reason=nothing' local res, data = pcall(function() return print(httpServ:PostAsync('thewebsite', sendData)) end)
this outputs:
<html> <link rel="stylesheet" type="text/css" href="mystyle.css"> <h1 style="font-size:60px;">Script index form<br></h1> Established a connection with given host successfully.<br>Successfully accessed databased specified.<br>Array ( )
The PHP and html
<html> <link rel="stylesheet" type="text/css" href="mystyle.css"> <h1 style="font-size:60px;">Script index form<br></h1> <?php $host = "fdb19.awardspace.net"; $username = "2626551_roblox"; $password = "-----"; $Rank = $_POST["Rank"]; $Color = $_POST["Color"]; $Reason = $_POST["Reason"]; $connection = mysqli_connect($host, $username, $password); $sql = "INSERT INTO roblox (Rank, Color, Reason) VALUES ('$Rank', '$Color', '$Reason')"; if(!$connection){ echo "Couldn't establish a connection with the given host, user and pass.<br>"; }else{ echo "Established a connection with given host successfully.<br>"; } if(!mysqli_select_db($connection, $username)) { echo "Could not access the database specified.<br>"; }else{ echo "Successfully accessed databased specified.<br>"; } if(isset($_POST["Rank"])) { if (!mysqli_query($connection, $sql)) { echo "Could not add data in to the table.<br>"; }else{ echo "Added data into table successfully.<br>"; } echo "Results :: Rank: " .$Rank. " | Color: " .$Color. " | Reason: " .$Reason ."<br>"; } print_r($_GET) // Outputs Array () which should have the data inside of it, but does not... ?>
Help would be greatly appreciated, thanks...