PageRenderTime 45ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/editor/latestproject.php

https://bitbucket.org/3tierlogic/3tl.tabbuilder
PHP | 23 lines | 23 code | 0 blank | 0 comment | 4 complexity | 1e88e690d8deb3aee1fd6dc5f197f1ab MD5 | raw file
  1. <?
  2. require_once("3tldb.php");
  3. $con_3tl = mysql_connect($dbhost_3tl, $dbuser_3tl, $dbpasswd_3tl); // connect to database
  4. if (!$con_3tl) { // error checking and handling
  5. die('Could not connect to 3TL: ' . mysql_error());
  6. }
  7. mysql_select_db($dbname_3tl);
  8. $sql = "SELECT ID, post_date, post_content, post_title FROM 3tierweb.tier_posts WHERE post_type='post' and post_parent='0' and post_status='publish' order by post_date desc Limit 1";
  9. $res = mysql_query($sql, $con_3tl);
  10. if (mysql_num_rows($res) > 0) {
  11. $picon = "";
  12. list($pid, $pdate, $pcontent, $ptitle) = mysql_fetch_array($res);
  13. $sql_icon = "SELECT guid FROM 3tierweb.tier_posts where post_type='attachment' and (post_mime_type='image/jpeg' or post_mime_type='image/png') and post_parent='".$pid."' order by post_date desc";
  14. $res_icon = mysql_query($sql_icon, $con_3tl);
  15. if (mysql_num_rows($res_icon) > 0) {
  16. list($picon) = mysql_fetch_array($res_icon);
  17. }
  18. echo "<a href='http://www5.3tierlogic.com/?p=".$pid."' target='_blank'><img src='".$picon."' width='240' height='150' /></a><p style='font:Verdana, Geneva, sans-serif; color:#FFF; font-size:10px '>".$ptitle."</p>";
  19. } else {
  20. echo "<a href='portfolio'><img src='images/latstproject.jpg' width='240' height='150' alt='project'></a>";
  21. }
  22. mysql_close($con_3tl);
  23. ?>