How to add insert a template to database????

Discussion in 'MySQL' started by amitash, Jun 23, 2010.

  1. #1
    I'm trying to insert a Wordpress Template tag to the wordpress database. I'm trying to add it as a variable. For example:
    <?php
    $query = <?php the_search_query (); >?;
    mysql_query("INSERT INTO downpump__searchterms (term, date) 
    VALUES ('$query', NOW())");
    ?> 
    PHP:
    But its not getting inserted to the database. Please Help me out!
     
    amitash, Jun 23, 2010 IP
  2. SNo

    SNo Member

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #2
    try this :
    
    <?php
    $query = the_search_query ();
    mysql_query("INSERT INTO downpump__searchterms (term, date)
    VALUES ('$query', NOW())");
    ?>
    
    PHP:
     
    SNo, Jun 23, 2010 IP
  3. amitash

    amitash Well-Known Member

    Messages:
    399
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    125
    #3
    This is not working!
     
    amitash, Jun 23, 2010 IP
  4. SNo

    SNo Member

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #4
    try this and post here the result :
    
    <?php
    $query = the_search_query ();
    die($query);
    //mysql_query("INSERT INTO downpump__searchterms (term, date)
    VALUES ('$query', NOW())");
    ?>
    
    PHP:
     
    SNo, Jun 24, 2010 IP
  5. amitash

    amitash Well-Known Member

    Messages:
    399
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    125
    #5
    Well, that doesn't solve either.. But i found out the trick!
     
    amitash, Jun 24, 2010 IP