Skip to content

Instantly share code, notes, and snippets.

@michaelcullum
Created February 6, 2012 00:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save michaelcullum/1748537 to your computer and use it in GitHub Desktop.
Save michaelcullum/1748537 to your computer and use it in GitHub Desktop.
get blog data
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