Search code examples
phpmysqlfacebook-like

Like button with mysql data and php


I'm testing my webiste and trying to input the like button on my links. What Im trying to do is to show the title, url and image from a mysql database, for example thats how my code is now:

<meta property="og:title" content="<?php echo $titulo; ?>" />
<meta property="og:type" content="website" />
<meta property="og:url" content="http://hogardelocio.com/pl.php?pl=<?php echo $lid; ?>" />
<meta property="og:image" content="http://hogardelocio.com/img/<?php echo $imagem; ?>" /> 
<meta property="og:site_name" content="Hogar del Ocio" />

On the debug it seens to be fine, it show the image, title and link properly, but if you click on the "like" button on my page and share it, it shows just this link "http://hogardelocio.com/pl.php?pl" and another image without title...

Here is the debug page: http://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fwww.hogardelocio.com%2Fpl.php%3Fpl%3D91

Can somebody help me? thank you


Solution

  • I took a look at your page, it seems that the error is not with your <meta> tags but with the fb:like button's data-href which is badly formatted:

    This is what on your page:

    <div class="fb-like" 
        data-href="http://hogardelocio.com/pl.php?pl='link.php?link=91'" 
        data-send="false" data-layout="button_count" data-width="20" 
        data-show-faces="false" data-font="arial">
    </div>
    

    where it should have been, if I am not mistaken:

    <div class="fb-like" data-href="http://hogardelocio.com/pl.php?pl=91" 
        data-send="false" data-layout="button_count" data-width="20" 
        data-show-faces="false" data-font="arial">
    </div>