Created
February 6, 2012 00:18
-
-
Save michaelcullum/1748537 to your computer and use it in GitHub Desktop.
get blog data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static function get_blog_data($blog_id) | |
{ | |
global $db; | |
if(!$blog_id) | |
{ | |
return false; | |
} | |
$sql_ary = array( | |
'SELECT' => 'b.*,c.*,u.*', | |
'FROM' => array( | |
BLOGS_TABLE => 'b', | |
BLOG_CATS_TABLE => 'c', | |
USERS_TABLE => 'u', | |
), | |
'WHERE' => 'b.blog_id = ' . $db->sql_escape($blog_id) . ' | |
AND c.cat_id = b.blog_cat_id | |
AND u.user_id = b.blog_poster_id', | |
); | |
$sql = $db->sql_build_query('SELECT', $sql_ary); | |
$result = $db->sql_query($sql); | |
if(!$result) | |
{ | |
return false; | |
} | |
$row = $db->sql_fetchrow($result); | |
$db->sql_freeresult($result); | |
return $row; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment