Insert current url on mysql database

I want to be able to insert the current URL of a .php file into my MySQL database,for example if the file is “www.domain.com/file.php”,when I open that file in a browser,the “www.domain.com/file.php” URL will be added to my database,can someone explain it to me how can I do that?I read somewhere that I can do it via $GET but I can’t figure it out how.Thanks.

Well, there are several ways. I would use the $_SERVER global variable. But, why would you need the entire url? FILE would give the page the script is running.

i need it because im sharing a script and i need to know all the webpages that the script is being uploaded on.
would you be kind enough to write that code for me because im only getting errors,thanks very much in advance.

Um yeah, no. What do you have now? What errors are you getting?

[php]<?php
try {
$bdd = new PDO(‘mysql:host=localhost;dbname=testi’, ‘root’, ‘password’);
}
catch(Exception $e) {
die('Error : ’ .$e->getMessage());
}

$url = “Link : http://” . $_SERVER[‘SERVER_NAME’] . $_SERVER[‘REQUEST_URI’] . “\r\n”;

?>
[/php] I can’t get it to write to the database.

And where do you try to do anything with the database?

write that code for me

LOL! :o

Sponsor our Newsletter | Privacy Policy | Terms of Service