MasterDany
30-03-2008, 13:22
ciao a tutti ho quasi completato il mio sito editorial con newsletter ect. Mi maanca solo uno script.Infatti ho deciso di utilizzare una layout fisso!Ed ho un problema quando scrivo gli articoli più lungi il testo ovviamente va fuori dal div perciò dovrei fare uno script che stoppa i caratteri della pagina e ne crea altri ecco lo script della pagina:
<?php
$mysql = new mysqli('localhost', 'root', '', 'html_it_articles');
if(!$mysql)
{
die("Errore di connessione al database, impossibile procedere");
}
if(!isset($_GET['id']))
{
header('Location: index.php');
}
$article = $mysql->query("
SELECT
AR.id AS id,
AR.title AS title,
AR.article AS content,
CONCAT(AU.surname, ' ', AU.name) AS author
FROM
articles AR,
authors AU
WHERE
AR.author_id = AU.id AND
AR.id = ".$_GET['id'])->fetch_assoc();
?>
<html>
<head>
<title>Articolo (<?php echo $article['id']; ?>)</title>
</head>
<body>
<h3><?php echo $article['title']; ?></h3>
<i><?php echo $article['author']; ?></i>
<p>
<?php echo $article['content']; ?>
</p>
</body>
</html>
avevo pensato di fare una cosa:
dichiarare una variabile di caratteri
$limit=200;
mettre questo nella select:
LIMIT ".(($page - 1) * $limit).",".$limit);
mettere quest oalla fine del div:
<p>Pagina <?php echo $page; ?> di <?php echo $totals_pages; ?> <br />
<?php
if($page - 1 > 0)
{
echo '<a href="?p='.($page - 1).'">< prev</a> | ';
}else
{
echo '< prev | ';
}
if($page + 1 <= $totals_pages)
{
echo '<a href="?p='.($page + 1).'">next ></a>';
}else
{
echo 'next >';
}
?>
</p>
M anaturalemnete non funziona...qualcuno sa dirmi come posso fare?
<?php
$mysql = new mysqli('localhost', 'root', '', 'html_it_articles');
if(!$mysql)
{
die("Errore di connessione al database, impossibile procedere");
}
if(!isset($_GET['id']))
{
header('Location: index.php');
}
$article = $mysql->query("
SELECT
AR.id AS id,
AR.title AS title,
AR.article AS content,
CONCAT(AU.surname, ' ', AU.name) AS author
FROM
articles AR,
authors AU
WHERE
AR.author_id = AU.id AND
AR.id = ".$_GET['id'])->fetch_assoc();
?>
<html>
<head>
<title>Articolo (<?php echo $article['id']; ?>)</title>
</head>
<body>
<h3><?php echo $article['title']; ?></h3>
<i><?php echo $article['author']; ?></i>
<p>
<?php echo $article['content']; ?>
</p>
</body>
</html>
avevo pensato di fare una cosa:
dichiarare una variabile di caratteri
$limit=200;
mettre questo nella select:
LIMIT ".(($page - 1) * $limit).",".$limit);
mettere quest oalla fine del div:
<p>Pagina <?php echo $page; ?> di <?php echo $totals_pages; ?> <br />
<?php
if($page - 1 > 0)
{
echo '<a href="?p='.($page - 1).'">< prev</a> | ';
}else
{
echo '< prev | ';
}
if($page + 1 <= $totals_pages)
{
echo '<a href="?p='.($page + 1).'">next ></a>';
}else
{
echo 'next >';
}
?>
</p>
M anaturalemnete non funziona...qualcuno sa dirmi come posso fare?