/editor/latestproject.php
PHP | 23 lines | 23 code | 0 blank | 0 comment | 4 complexity | 1e88e690d8deb3aee1fd6dc5f197f1ab MD5 | raw file
- <?
- require_once("3tldb.php");
- $con_3tl = mysql_connect($dbhost_3tl, $dbuser_3tl, $dbpasswd_3tl); // connect to database
- if (!$con_3tl) { // error checking and handling
- die('Could not connect to 3TL: ' . mysql_error());
- }
- mysql_select_db($dbname_3tl);
- $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";
- $res = mysql_query($sql, $con_3tl);
- if (mysql_num_rows($res) > 0) {
- $picon = "";
- list($pid, $pdate, $pcontent, $ptitle) = mysql_fetch_array($res);
- $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";
- $res_icon = mysql_query($sql_icon, $con_3tl);
- if (mysql_num_rows($res_icon) > 0) {
- list($picon) = mysql_fetch_array($res_icon);
- }
- 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>";
- } else {
- echo "<a href='portfolio'><img src='images/latstproject.jpg' width='240' height='150' alt='project'></a>";
- }
- mysql_close($con_3tl);
- ?>