steelth
-
Posts
2 -
Joined
-
Last visited
Never
Posts posted by steelth
-
-
My problem starts in the while() loop. $row = mysql_fetch_assoc($result) returns no value even though i have records in my database.
Same with:
$id = $row['id'] or die ("Failed");
$gold = $row['gold'] or die ("Failed");
$title = $row['title'] or die ("Failed");
$description = $row['description'] or die ("Failed");
$link = $row['link'] or die ("Failed");
They return nothing
<?php
include '../config2.php';
include '../dbconnect.php';
$sql = 'SELECT * FROM downloads ORDER BY title ASC';
$result = mysql_query($sql) or die ("Table Selection Failed");
if(mysql_fetch_array($result) == TRUE)
{
while($row = mysql_fetch_assoc($result))
{
$id = $row['id'] or die ("Failed");
$gold = $row['gold'] or die ("Failed");
$title = $row['title'] or die ("Failed");
$description = $row['description'] or die ("Failed");
$link = $row['link'] or die ("Failed");
echo '<table width="380" border="1"><tr><td><div align="center">';
if($gold == true)
{
echo '*';
}
echo '<a href="';
echo $link;
echo '" target="_blank" class="';
if($gold == true)
{
echo 'fontsize12 colorFFB200" id="';
}
else
{
echo'color8EA0C1 fontsize12" id="';
}
echo $id;
echo '">';
echo $title;
echo '</a>';
if($gold == true)
{
echo '*';
}
echo '</div></td></tr></table><table width="380" border="0"><tr><td><div align="center">';
echo $description;
echo '</div></td></tr></table><div align="center"><br></div>';
}
}
else
{
echo '<div align="center">There are no Links in this category.</div>';
}
include '../dbclose.php';
?>
mysql array returns nothing?
in MySQL Help
Posted
Still returns no rows.
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] <?php
include '../config2.php';
include '../dbconnect.php';
$sql = 'SELECT * FROM downloads ORDER BY title ASC';
$result = mysql_query($sql) or die ("Table Selection Failed");
if(mysql_num_rows() >0)
{
while($row = mysql_fetch_assoc($result))
{
$id = $row['id'];
$gold = $row['gold'];
$title = $row['title'];
$description = $row['description'];
$link = $row['link'];
echo '<table width="380" border="1"><tr><td><div align="center">';
if($gold == true)
{
echo '*';
}
echo '<a href="'.$link.'" target="_blank" class="';
if($gold == true)
{
echo 'fontsize12 colorFFB200" id="';
}
else
{
echo'color8EA0C1 fontsize12" id="';
}
echo $id.'">'.$title.'</a>';
if($gold == true)
{
echo '*';
}
echo '</div></td></tr></table><table width="380" border="0"><tr><td><div align="center">'.$description.'</div></td></tr></table><div align="center"><br></div>';
}
}
else
{
echo '<div align="center">There are no Links in this category.</div>';
}
include '../dbclose.php';
?>