Archive for 08/10/14

How to style the first occurrence of an element inside of another element?

by in , 0

Here's my problem.
HTML
<div id="content">
    <h1>Headline</h1>
    <p>First paragraph that needs to be yellow.</p>
    <p>Second paragraph that need not change. :) </p>
    <p>Third paragraph that need not change. :) </p>
</div>
If I use #content p:first-child {color:yellow; } it doesn't work because p isn't the first-child of content... h1 is the first born.
How can I do this without touching the HTML code?

Read more »

PDO query to fetch all tables

by in , 0

Execute the query with PDO::query():
SHOW TABLES;
If you fetch an associative array, the name of the column will be:
Tables_in_databasename
Note: this will list both tables and views. If you must get only tables, use this instead:
SELECT 
  TABLE_NAME
FROM information_schema.TABLES 
WHERE
  TABLE_TYPE='BASE TABLE'
  AND TABLE_SCHEMA='yourdatabasename';