Skip to content

Commit

Permalink
whatever i changed
Browse files Browse the repository at this point in the history
  • Loading branch information
crutchy- committed Feb 14, 2015
1 parent 54fb7e7 commit 053a647
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
8 changes: 8 additions & 0 deletions website/news.my.to/db.inc
Expand Up @@ -22,6 +22,14 @@ function db__get_all_stories()

#####################################################################################################

function db__get_story($sid)
{
$params=array("sid"=>$sid);
return db__fetch_prepare("db__get_story",$params);
}

#####################################################################################################

function db__insert_story($story)
{
$params=array("title"=>$story["title"],"content"=>$story["content"]);
Expand Down
5 changes: 5 additions & 0 deletions website/news.my.to/index.inc
Expand Up @@ -49,6 +49,11 @@ $menu=str_replace("%%menu_items%%",$menu_items_html,$menu);
$body=$menu;
if (isset($_GET["sid"])==True)
{

$story=db__get_story($_GET["sid"]);

var_dump($story);

$page=str_replace("%%title%%","news.my.to: story".$_GET["sid"],$page);
$story_html="<p>THIS IS A TEST<br>sid = ".$_GET["sid"]."</p>";
$body=$body.$story_html;
Expand Down
4 changes: 4 additions & 0 deletions website/news.my.to/mysql/db__get_story.sql
@@ -0,0 +1,4 @@
SELECT * FROM news_my_to.stories AS p1
LEFT JOIN (SELECT `sid` AS sid_score,SUM(`mod`) AS score FROM news_my_to.story_mods GROUP BY `sid`) AS p2 ON p1.`sid`=p2.sid_score
LEFT JOIN (SELECT `sid` AS sid_comments,COUNT(*) AS comments FROM news_my_to.comments GROUP BY `sid`) AS p3 ON p1.`sid`=p3.sid_comments
WHERE `sid`=:sid

0 comments on commit 053a647

Please sign in to comment.