Page 1 of 1

While help

Posted: Mon Aug 16, 2004 9:44 am
by AlbinoJellyfish
http://www.sevengfx.com/content/viewd.php
This fetch array error is bugging me. I cant figure out how to stop it.

Code: Select all

<?php

$db = mysql_connect("localhost","sevengfx","dunc4n12"); 
mysql_select_db("sevengfx_com_-_sevenadmin" , $db) or die("Couldn't open $db: ".mysql_error()); 
$result = mysql_query("SELECT * FROM `category` ORDER BY `id` DESC");
$row = mysql_num_rows($result);
while($row1 = mysql_fetch_array($result)){
echo '<table border="0" cellpadding="0" cellspacing="0" width="334" height="1">
          <tr>
<td width="330" height="13" background="bar_dark.gif" valign="top"> 
              <p align="center" style=" margin-top: 0; margin-bottom: 0"><b><font color="#000000"> ';
			  echo $row1['category'];
			  $category = $row1['id'];
			  echo'</font></b></p> 
            </td> 
          </tr> 
          <tr> 
            <td width="330" valign="top"> 
              <p style="text-indent: 20">';
$query1 = "SELECT * FROM downloads ORDER BY id DESC WHERE category='$category'"; 
$result1=mysql_query($query1); 
while ($row = mysql_fetch_array($result1)){ 
if ($row['prefix'] == NULL){
echo $row['description'];
echo ':';
echo $row['info'];
echo '<br> Added on: ';
echo $row['date'];
echo '<br><center><a href="', $row['url'],'">';
echo '<b>D/L</b></a>   <a href="',$row['ss'],'"><b>Screenshot</b></a><br><br>';
}else{
echo '<strong>';
echo $row['prefix'];
echo '</strong> - ';
echo $row['description'];
echo ':';
echo $row['info'];
echo '<br> Added on: ';
echo $row['date'];
echo '<br><center><a href="', $row['url'],'">';
echo '<b>D/L</b></a>   <a href="',$row['ss'],'"><b>Screenshot</b></a><br><br>';
}
echo '</td> 
          </tr><br>';
		  echo '</table>';
		  }}



?>

Posted: Mon Aug 16, 2004 10:02 am
by markl999
Try the 3 things at the top of viewtopic.php?t=17096 first, see if that highlights the problem.

Posted: Mon Aug 16, 2004 10:39 am
by Joe
Try:

Code: Select all

<?php 

$db = mysql_connect("localhost","sevengfx","dunc4n12"); 
mysql_select_db("sevengfx_com_-_sevenadmin" , $db) or die("Couldn't open $db: ".mysql_error()); 
$result = mysql_query("SELECT * FROM `category` ORDER BY `id` DESC"); 
$row = mysql_num_rows($result); 
while($row1 = mysql_fetch_array($result)){ 
echo '<table border="0" cellpadding="0" cellspacing="0" width="334" height="1"> 
          <tr> 
<td width="330" height="13" background="bar_dark.gif" valign="top"> 
              <p align="center" style=" margin-top: 0; margin-bottom: 0"><b><font color="#000000"> '; 
           echo $row1['category']; 
           $category = $row1['id']; 
           echo'</font></b></p> 
            </td> 
          </tr> 
          <tr> 
            <td width="330" valign="top"> 
              <p style="text-indent: 20">'; 
$query1 = "SELECT * FROM downloads ORDER BY id DESC WHERE category='$category'"; 
$result1=mysql_query($query1); 
while (true)
{
$row = mysql_fetch_array($result1);
if ($row == false) break; 
if ($row['prefix'] == NULL){ 
echo $row['description']; 
echo ':'; 
echo $row['info']; 
echo '<br> Added on: '; 
echo $row['date']; 
echo '<br><center><a href="', $row['url'],'">'; 
echo '<b>D/L</b></a>   <a href="',$row['ss'],'"><b>Screenshot</b></a><br><br>'; 
}else{ 
echo '<strong>'; 
echo $row['prefix']; 
echo '</strong> - '; 
echo $row['description']; 
echo ':'; 
echo $row['info']; 
echo '<br> Added on: '; 
echo $row['date']; 
echo '<br><center><a href="', $row['url'],'">'; 
echo '<b>D/L</b></a>   <a href="',$row['ss'],'"><b>Screenshot</b></a><br><br>'; 
} 
echo '</td> 
          </tr><br>'; 
        echo '</table>'; 
        }} 



?>