Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Connect to MariaDB Server</title>
- </head>
- <body>
- <?php
- $dbhost = 'localhost';
- $dbuser = 'test';
- $dbpass = 'pass';
- $dbname = 'databseName';
- $conn = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
- if(! $conn ) {
- die("Connection failed: " . mysqli_connect_error());
- }
- echo "Connected successfully<br><br>";
- function add($url, $category){
- $sql = "INSERT INTO tt (url, category) VALUES ('$url', '$category');";
- if(mysqli_query($conn, $sql)){
- echo "Recorded.";
- } else {
- echo "Error: " . $sql . "<br>" . mysqli_error($conn);
- }
- }
- if(function_exists($_GET['f'])){
- $_GET['f']($_GET['url'], $_GET['cat']);
- }
- mysqli_close($conn);
- ?>
- </body>
- </html>
- Connected successfully
- Error: INSERT INTO tt (url, category) VALUES ('google', 'google');
Add Comment
Please, Sign In to add comment