$row = mysql_fetch_array($results);
while($row = mysql_fetch_array( $results )) {
Hi
I'm trying to list the articles in section 105 and use this link:
http://127.0.0.1/Takfekr/htdocs/section.php?id=105
with this code:
section.php:
Code: Select all
<?php
include 'global.php';
if (isset($_GET['id'])) {
$section_id = $_GET['id'];
$sql = "SELECT * FROM articles WHERE section = '$section_id' ORDER BY id";
$results = mysql_query($sql) or die (mysql_error());
$row = mysql_fetch_array($results);
while($row = mysql_fetch_array( $results )) {
$title=$row['title'];
$text=$row['text'];
$username=$row['username'];
$name=$row['name'];
?>
<div class="article_header">
<h1 dir="rtl">
<?php echo "hello!"; echo $title ;?></h1>
<div class="asd1"> </div>
<div style="float: right;" dir="rtl">
<span dir="rtl">writer:
<br> <? echo $name; ?></a></span>
</div>
<br>
</div>
<br>
<!-- ARTICLE CONTENT START -->
<p class="MsoNormal" dir="rtl"><?php echo $text; ?> </p>
<br><p class="MsoNormal" dir="rtl">
<?php
}
?>
<o:p></o:p></p>
<!-- ARTICLE COMMENTS STOP -->
</div>
</div>
<?php
}
else header('Location: account.php');
?>Code: Select all
$query = "SELECT Count(*) FROM articles WHERE section='$section_id'";
$result = mysql_query($query) or die(mysql_error());
echo 'count: ', mysql_result($result, 0), "<br />\n";count: 1
what's the problem?
thanks in advance