I want to grab the username TEST from the URL and insert it into the database. This is just an example. Using prepared statements and an example from W3Schools, this will be the PHP code:
<?php
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "myDBPDO";
try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// prepare sql and bind parameters
$stmt = $conn->prepare("INSERT INTO MyGuests (username)
VALUES (:username)");
$stmt->bindParam(':username', $username);
// insert a row
$firstname = "John"; //THIS IS WHERE I WANT THE TEST USERNAME TO GO FROM THE URL
$stmt->execute();
echo "New records created successfully";
} catch(PDOException $e) {
echo "Error: " . $e->getMessage();
}
$conn = null;
?>
I have tried using $_GET[‘’] but it just isn’t having it. Any ideas would be greatly appreciated this is making me mad xD
People here ask questions about Roblox Lua and Lua questions because it has similarities with Roblox Lua not PHP, why are you asking a PHP question here?
You will not get any good answers because people here use Roblox Lua and Lua and this forum is intended for Roblox games not outside of Roblox.
if your question is related to Roblox in someway like using HttpService to get information from your website then I’d say that you can ask this here but I don’t think it is because you’ve never mentioned that in this thread.
I assume it does, but I’m not exactly sure because PHP is such a pain to work with. I assume that PHP uses "" to index data from arrays so I guess it matters.
Also if that’s all the questions you have about PHP you should mark this thread as resolved.