PHP - 访问URL时将数据发布到数据库? [关闭]

I am fairly new at PHP.

Is it possible to post data to a database on visit of a URL?

I want the user to scan a QR code that open up a link that just echo a message. But in the back end the date and time is recorded to a database. How would I do that?

Thanks again

Yes, it is very possible...

yourscript.php

<?php
$somedata=isset($_GET['somedata'])?$_GET['somedata']:null;
$conn=getYourDBConnction();
$sql='INSERT INTO yourTable(datatime,somedata) VALUES(NOW(),?);
$stmt=$conn->prepare($sql);
$stmt->execute(array($somedata));
echo('response');