Search Results

Search found 2 results on 1 pages for 'kerilynn'.

Page 1/1 | 1 

  • How can I use "PHP Simple HTML DOM Parser" to get the contents of an <h1></h1> tag?

    - by KeriLynn
    I'm new to PHP =) Right now I am using PHP includes for my site template. I have my header, containing all my <head></head> info. What I want to do is write a code that will take the contents of the <h1></h1> tag from the page, and echo it into the <title></title> tag in my header.php include. I got the PHP Simple HTML DOM Parser from here: http://simplehtmldom.sourceforge.net/, and I found a code (I forget where in all my googling) that goes like this: <?php $url = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; $html = file_get_html('http://www.google.com/'); foreach($html->find('#content h1') as $element){ echo $element->plaintext;} ?> That I think is supposed to echo the h1 tag contents? Like I said, I'm new to PHP and I only know the basics, and I don't know really know any OOP (yet), so I'm sorry if I'm asking a dumb question. It looks like it's getting the current page, then putting the contents of the h1 tag into the variable $element, and then echoing it. But nothing happens when I put it into my page. Can anyone help me with what I'm doing wrong? Thank you for reading!! =)

    Read the article

  • mysql: Can I use two "where"s? Like, "SELECT * FROM table WHERE something and something"?

    - by KeriLynn
    I have a table with my products and I'm trying to write a page that would pull bracelets with certain colors from the database. So here's what I have right now (in php): $query = "SELECT * FROM products WHERE (products.colors LIKE '%black%')"; But I only want to select rows where the value for the column "category" equals "bracelet". I've tried a few different things, but I keep getting warnings and errors. I appreciate any help you can give, thank you!

    Read the article

1