Cod: Selectaţi tot
//parcurgerea matricei cu datele obtinute
while ( $list = mysql_fetch_assoc($result) ) {
//stocheaza datele returnate de mysql in variabile array pt fiecare coloana
$id[] = $list['id'];
$data[] = $list['data'];
$titlu[] = $list['titlu'];
$continut[] = $list['continut'];
$comentarii[] = $list['comentarii'];
}
mysql_close();
/*********************************** AFISAREA DATELOR ****************************/
global $id;
for ( $i = 0; $i < count($id); $i++) {
echo '<br /><div id="stire">
<div id="title">'
.$titlu[$i].
'</div><!-- end newsTitle -->
<small id="posted">'
.$data[$i].
'</small><!-- end posted -->
<small id="comentarii">'
.$comentarii[$i].' comentarii
</small><!-- end comentarii -->
<div id="continutStire">'
.substr($continut[$i], 0, 150).'[...] <a href="oneNews.php?id=$id[$i]" id="readMore">articol complet » </a>
</div><!-- end continut -->
</div><!-- end stiri -->';
}
oneNews.php
Cod: Selectaţi tot
<?php
include ("conexiune.php");
if ( isset($_GET['id']) ) {
global $conexiune;
$id = $_GET['id'];
$query = "SELECT * FROM stiri WHERE id = '{$id}'";
$result = mysql_query($query,$conexiune) or die(mysql_error());
$dbarray = mysql_fetch_array($result);
if ($dbarray) { echo 'eroare'; }
echo '<br /><div id="stire">
<div id="title">'
.$dbarray['titlu'].
'</div><!-- end newsTitle -->
<small id="posted">'
.$dbarray['data'].
'</small><!-- end posted -->
<small id="comentarii">'
.$dbarray['comentarii'].' comentarii
</small><!-- end comentarii -->
<div id="continutStire">'
.$dbarray['continut'].
'</div><!-- end continut -->
</div><!-- end stiri -->';
}
mysql_close();
?>
care e problema, caci atunci cand dau read more,nu-mi afiseaza stirea. ci doar structura paginii?