<?php
require("dati.php");
$tot = 3;
$query = "SELECT * FROM news30_story
ORDER by id desc
LIMIT 0,$tot";
$result = mysql_query($query)
or die("Caricamento fallito: ".mysql_error());
while ($row = mysql_fetch_array($result))
{
echo "<a href='news_1.php?id=".$row['title']."'><b>", $row['title'], "</b></a>";
echo "<br>";
echo "<font>", substr ($row['story'],0,150), " (..)</font>";
echo "<br>";
}
mysql_close($connection);
?>
<?php
require_once('news/db.php');
require_once('news/config.php');
// Category to use
$category = 'Sports';
// Grab the ID of the category
$categoryid = DataAccess::fetch(sprintf("SELECT id FROM %s WHERE name = ?", NEWS_CATS), $category);
$categoryid = $categoryid['0']['id'];
// Grab all news articles assigned to the category
$newsarticles = DataAccess::fetch(sprintf("SELECT title, story, shortstory FROM %s WHERE id IN (SELECT storyid FROM %s WHERE catid = ?)", NEWS_ARTICLES, NEWS_GROUPCATS), $categoryid);
// Loop through each one
foreach($newsarticles AS $article){
echo "<a href='news_1.php?id=".$article['title']."'><b>", $article['title'], "</b></a>";
echo "<br>";
echo "<font>", substr ($article['story'],0,150), " (..)</font>";
echo "<br>";
}
?>
<?php
require("dati.php");
$tot = 10;
$query = "SELECT * FROM news_story WHERE id = " . $_GET['id'] . " ORDER by id desc";
$row = mysql_fetch_array(mysql_query($query));
echo "<h1>", $row['title'], "</h1>";
echo "<p>";
echo $row['story'];
echo "</p>";
mysql_close($connection);
?>
<?php
require_once('news/db.php');
require_once('news/config.php');
// Category to use
$category = 'Sports';
// Grab the ID of the category
$categoryid = DataAccess::fetch(sprintf("SELECT id FROM %s WHERE name = ?", NEWS_CATS), $category);
$categoryid = $categoryid['0']['id'];
// Grab all news articles assigned to the category
$newsarticles = DataAccess::fetch(sprintf("SELECT title, story, shortstory, id FROM %s WHERE id IN (SELECT storyid FROM %s WHERE catid = ?)", NEWS_ARTICLES, NEWS_GROUPCATS), $categoryid);
// Loop through each one
foreach($newsarticles AS $article){
echo "<a href='news_1.php?id=".$article['id']."'><b>", $article['title'], "</b></a>";
echo "<br>";
echo "<font>", substr ($article['story'],0,150), " (..)</font>";
echo "<br>";
}
?>
<?php
require_once('news/db.php');
require_once('news/config.php');
$article = DataAccess::fetch(sprintf("SELECT * FROM %s WHERE id = ?", NEWS_ARTICLES), $_GET['id']);
echo " <h1>", $article['0']['title'], "</h1>";
echo "<p>";
echo $article['0']['story'];
echo "</p>";
?>
$query = "SELECT * FROM news_story WHERE id = " . $_GET['id'] . " ORDER by id desc";
<?php
include 'news/index.php';
?>
<?php
require_once('news/db.php');
require_once('news/config.php');
// Category to use
$category = 'Sports';
// Grab the ID of the category
$categoryid = DataAccess::fetch(sprintf("SELECT id FROM %s WHERE name = ?", NEWS_CATS), $category);
$categoryid = $categoryid['0']['id'];
// Grab all news articles assigned to the category
$newsarticles = DataAccess::fetch(sprintf("SELECT title, story, shortstory, id FROM %s WHERE id IN (SELECT storyid FROM %s WHERE catid = ?)", NEWS_ARTICLES, NEWS_GROUPCATS), $categoryid);
// Loop through each one
foreach($newsarticles AS $article){
echo "<a href='news_1.php?id=".$article['id']."'><b>", $article['title'], "</b></a>";
echo "<br>";
echo "<font>", substr ($article['story'],0,150), " (..)</font>";
echo "<br>";
}
?>
$newsarticles = DataAccess::fetch(sprintf("SELECT title, story, shortstory, id FROM %s WHERE id IN (SELECT storyid FROM %s WHERE catid = ?)", NEWS_ARTICLES, NEWS_GROUPCATS), $categoryid);
$newsarticles = DataAccess::fetch(sprintf("SELECT title, story, shortstory, id FROM %s WHERE id IN (SELECT storyid FROM %s WHERE catid = ? ORDER BY id DESC)", NEWS_ARTICLES, NEWS_GROUPCATS), $categoryid);
<?php
require_once('news/db.php');
require_once('news/config.php');
// Category to use
$category = 'news';
// Grab the ID of the category
$categoryid = DataAccess::fetch(sprintf("SELECT id FROM %s WHERE name = ?", NEWS_CATS), $category);
$categoryid = $categoryid['0']['id'];
// Grab all news articles assigned to the category
$newsarticles = DataAccess::fetch(sprintf("SELECT title, story, shortstory, id FROM %s WHERE id IN (SELECT storyid FROM %s WHERE catid = ? ORDER BY id ASC)", NEWS_ARTICLES, NEWS_GROUPCATS), $categoryid);
// Loop through each one
foreach($newsarticles AS $article){
echo "<div style='border-bottom:1px solid #999'>";
echo "<a href='news1.php?id=".$article['id']."'><b>", $article['title'], "</b></a>";
echo "<br>";
echo "<font>", substr ($article['shortstory'],0,150), " (..)</font>";
echo "</div>";
echo "<br>";
}
?>