[solved] no output

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
m2babaey
Forum Contributor
Posts: 364
Joined: Sun May 20, 2007 9:26 am

[solved] no output

Post 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
Last edited by m2babaey on Tue Jul 17, 2007 3:32 am, edited 1 time in total.
afbase
Forum Contributor
Posts: 113
Joined: Tue Aug 15, 2006 1:29 pm
Location: SoCAL!!!!

Post 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
Post Reply