If you are usign SEO in "Spider-Friendly URL's" you have to change the Select and the href code:
Code:
SELECT p.id,p.user,p.userid,p.cat,p.bigimage,p.title,c.catname,c.photos,c.posts
FROM pp_photos p LEFT JOIN pp_categories c ON c.id = p.cat
WHERE p.storecat = 0
AND p.cat NOT IN (500)
ORDER BY RAND()
LIMIT 1
And the href:
Code:
print "<div align=\"center\">
<a href=\"gallery_url/g" . $row['cat'] . "-" . $row['catname'] . ".html\">
<img ...
I'm not php programmer but I know about programming

and I used the code from vb profile integration published in photopost official site.
It works in my site about
aquariums