Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


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.