Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


Shane McC
Shane McC
3,005 Points

Schema Markup, What am I doing wrong?

Hi Everyone,

I added schema markup to my website. I use the Google Structured Data Testing Tool and it's saying I don't have any microdata schema markup?

My syntax is below. What am I doing wrong?

echo '<center>';
echo "<table id='message' border='1'>";
echo "<thead>";
echo "<tr> <th>Dealership</th> <th>Address</th> <th>State</th> <th>City</th>    <th>Zip</th> <th>Phone</th> <th>Website</th> </tr>";
echo "</thead>";
echo "<tbody>";
$sql2 = mysql_query("SELECT DISTINCT dealership, address, state, city, zip, phone,     website
FROM dealers
WHERE (state = '".$state."')
AND (approve = '1')

while($row = mysql_fetch_array($sql2)){
$dealership = $row["dealership"];
$address = $row["address"];
$city = $row["city"];
$zip = $row["zip"];
$phone = $row["phone"];
$website = $row["website"];

$needle = 'http://';

if (!preg_match("|^http://|", $website)){
$website = $needle.$website;

echo "<div itemscope itemtype=\"http://schema.org/AutoDealer\">
        <td><strong><span itemprop=\"name\">$dealership</span></strong></td>
        <td><span itemprop=\"address\">$address</span></td>
        <td><span itemprop=\"addressRegion\">$state</span></td>
        <td><span itemprop=\"addressLocality\">$city</span></td>
        <td><span itemprop=\"postalCode\">$zip</span></td>
        <td><span itemprop=\"telephone\">$phone</span></td>
        <td><span itemprop=\"url\"><a href=\"$website\">Click Here</a></span>     </td>
echo "</tbody>";
echo '</table>

The above syntax would produce this

<table id='message' border='1'>
<th>Dealership</th> <th>Address</th> <th>State</th> <th>City</th> <th>Zip</th>     <th>Phone</th> <th>Website</th> 
<div itemscope itemtype="http://schema.org/AutoDealer">
        <td><strong><span itemprop="name">John Doe Car Sales</span>   </strong></td>
        <td><span itemprop="address">John Doe Highway</span></td>
        <td><span itemprop="addressRegion">Alaska</span></td>
        <td><span itemprop="addressLocality">Anchorage</span></td>
        <td><span itemprop="postalCode">99515</span></td>
        <td><span itemprop="telephone">123456789</span></td>
        <td><span itemprop="url"><a  href="http://dependablecarsanchorageak.com">Click Here</a></span></td>

<div itemscope itemtype="http://schema.org/AutoDealer">
        <td><strong><span itemprop="name">Jane Doe Car Sales</span>  </strong></td>
        <td><span itemprop="address">Jane Doe Car Avenue</span></td>
        <td><span itemprop="addressRegion">Alaska</span></td>
        <td><span itemprop="addressLocality">Anchorage</span></td>
        <td><span itemprop="postalCode">99503</span></td>
        <td><span itemprop="telephone">123456789</span></td>
        <td><span itemprop="url"><a href="http://akrto.com/">Click Here</a></span></td>


1 Answer

Vijay Rangan
Vijay Rangan
7,543 Points

Try looking at the beginning of your php file. It looks like you're missing something. Let me know how it goes.