Question: Before anything pops up in your mind, please understand that I am very new to PHP and to be honest, I am depending exclusively on stack overflow to build my simple and first php web application. 

I am trying to get the data from a query string and store it in my database. I want someone to write a short piece of code to check whether the string exists and if it does, add it to my database. I am using wordprss so i think we can use $\_GET and $wpdb but i don't know the syntax. The url with querystring is something like:
<http://www.mydomain.tld/?publishid=1235ABC>

Answer: 
According to given address <http://www.mydomain.tld/?publishid=1235ABC> it would be something like below::

```
    <?php
       $input = isset($_GET['publishid']) ? $_GET['publishid'] : '';
       if(!empty($input)) {
          $query = "INSERT INTO table (input_field) VALUES ('$input')";
          mysql_query($query);
       }
    ?>

```
Something like this would check if the publishid exists in the GET variable. The rest depends on which database you are using, and what do you want to do if it doesn't exist.

```
if(!isset($_GET['publishid']))
{
       //Do whatever you want if the key does not exists
}
else
{
//Insert into the database.  
}

```