Page 1 of 1

[solved] no output

Posted: Mon Jul 16, 2007 11:42 pm
by m2babaey
the problem was:
$row = mysql_fetch_array($results);
while($row = mysql_fetch_array( $results )) {
:lol: :lol:
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> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<? 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');
?>
and section 105 is not empty. it has 1 record because when I use:

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";
It sends:
count: 1
what's the problem?
thanks in advance

Posted: Tue Jul 17, 2007 3:00 am
by afbase
please give us something other than 127.0.0.1/etc/etc

that 127.0.0.1 usually your localhost or some proxy