Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.
Moderator: General Moderators
-
AlbinoJellyfish
- Forum Commoner
- Posts: 76
- Joined: Sun Apr 04, 2004 7:39 pm
Post
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>';
}}
?>
-
markl999
- DevNet Resident
- Posts: 1972
- Joined: Thu Oct 16, 2003 5:49 pm
- Location: Manchester (UK)
Post
by markl999 »
Try the 3 things at the top of
viewtopic.php?t=17096 first, see if that highlights the problem.
-
Joe
- Forum Regular
- Posts: 939
- Joined: Sun Feb 29, 2004 1:26 pm
- Location: UK - Glasgow
Post
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>';
}}
?>