Guest_imported
New member
- Jan 1, 1970
- 0
Hi, I was wondering if someone could help fix the script below, it's being real annoying, i'm sure the mistake is obvious i used a previous script i made and edited it alot and now it doesn't work. I think it's got something todo with the values not being picked up for the $data variable.
If someone could help I'd be very greatful. Thanx
<?
if (!isset($debut)) $debut = 0;
$db = mysql_connect($host,$login,$pass);
mysql_select_db($base,$db);
$sql2 = "SELECT * FROM bands_tbl WHERE cat = '$cat' ORDER BY name ASC ";
$req2 = mysql_query($sql2) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
$nb = mysql_num_rows($req2);
$sql = "SELECT * FROM bands_tbl WHERE cat = '$cat' ORDER BY name ASC LIMIT $debut,$limit ";
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
if ($nb<1) {
echo '<center><font face="Verdana" size="2"><b>No bands in this category</b></font></center>';
} else {
while($data = mysql_fetch_array($req))
echo '<p align="left" style="margin-bottom: 5"><font face="Verdana" size="2"><img border="0" src="../images/lnav_5.gif" width="12" height="8"><a href="band_info.php?id='.$data['id'].'">
<b>'.$data['name'].'</b></a></font><b><font face="Verdana" size="1"> [</font></b>';
$sql3 = "SELECT * FROM tabs_tbl WHERE band_id = '.$data['id'].'";
$req3 = mysql_query($sql3) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
$nb3 = mysql_num_rows($req3);
if ($nb3<1) {
echo '';
} else {
echo '<font face="Verdana" size="1">Tabs - <a href="tabs_songs.php?id='.$data['id'].'&name='.$data['name'].'&filetype='.bass_tabs.'&filetype_name='.Bass_Tabs.'">Bass</a> | <a href="tabs_songs.php?id='.$data['id'].'&filetype='.drum_tabs.'&filetype_name='.Drum_Tabs.'">Drum</a> | <a href="tabs_songs.php?id='.$data['id'].'&filetype='.guitar_tabs.'&filetype_name='.Guitar_Tabs.'">Guitar</a>] - </font>';
}
$sql4 = "SELECT * FROM tabs_tbl WHERE band_id = '.$data['id'].' & filetype = 'lyrics'";
$req4 = mysql_query($sql4) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
$nb4 = mysql_num_rows($req4);
if ($nb4<1) {
echo '';
} else {
echo '<font face="Verdana" size="1">[<a href="tabs_songs.php?id='.$data['id'].'&filetype='.lyrics.'&filetype_name='.Lyrics.'">Lyrics</a>] - </font>';
}
echo '[<a href="bandreviews.php?band_id='.$data['id'].'">Reviews</a>]</font></p>
<div align="center">
<table border="0" width="90%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%"><font face="Verdana" size="1" color="#D0CCD0">'.$data['description'].' </font></td>
</tr>
</table>
</div>
<p align="right" style="margin-top: 5"><font face="Verdana" size="1" color="#000000">[ Rating:
'.$data['vote_avg'].'
Votes: '.$data['nbr_votes'].' ] </font><font face="Verdana" size="1"><a href="javascript:Rate_Band(\'rateband.php?id='.$data['id'].'\')"><u>Rate
Band</u></a></font></p>
<p align="right">';
$nombre=ceil($nb/$limit);
echo "<center>"; if($debut>0)
{
echo "<font face=\"Verdana\" size=\"1\"><a href=bands.php?cat=$cat&debut=".($debut-$limit). "><<</a> </font> ";
}
if ($nombre>1)
{ for($i=1; $i<=$nombre; $i++)
{
echo "<font face=\"Verdana\" size=\"1\"><a href=bands.php?cat=$cat&debut=".(($i-1)*$limit). ">".$i. "</a> </font> ";
}
}
if(($debut+$limit)<$nb)
{
echo "<font face=\"Verdana\" size=\"1\"><a href=bands.php?cat=$cat&debut=".($debut+$limit). ">>></a></font>";
}
echo "</CENTER>";
} mysql_close($db);
?>
If someone could help I'd be very greatful. Thanx
<?
if (!isset($debut)) $debut = 0;
$db = mysql_connect($host,$login,$pass);
mysql_select_db($base,$db);
$sql2 = "SELECT * FROM bands_tbl WHERE cat = '$cat' ORDER BY name ASC ";
$req2 = mysql_query($sql2) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
$nb = mysql_num_rows($req2);
$sql = "SELECT * FROM bands_tbl WHERE cat = '$cat' ORDER BY name ASC LIMIT $debut,$limit ";
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
if ($nb<1) {
echo '<center><font face="Verdana" size="2"><b>No bands in this category</b></font></center>';
} else {
while($data = mysql_fetch_array($req))
echo '<p align="left" style="margin-bottom: 5"><font face="Verdana" size="2"><img border="0" src="../images/lnav_5.gif" width="12" height="8"><a href="band_info.php?id='.$data['id'].'">
<b>'.$data['name'].'</b></a></font><b><font face="Verdana" size="1"> [</font></b>';
$sql3 = "SELECT * FROM tabs_tbl WHERE band_id = '.$data['id'].'";
$req3 = mysql_query($sql3) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
$nb3 = mysql_num_rows($req3);
if ($nb3<1) {
echo '';
} else {
echo '<font face="Verdana" size="1">Tabs - <a href="tabs_songs.php?id='.$data['id'].'&name='.$data['name'].'&filetype='.bass_tabs.'&filetype_name='.Bass_Tabs.'">Bass</a> | <a href="tabs_songs.php?id='.$data['id'].'&filetype='.drum_tabs.'&filetype_name='.Drum_Tabs.'">Drum</a> | <a href="tabs_songs.php?id='.$data['id'].'&filetype='.guitar_tabs.'&filetype_name='.Guitar_Tabs.'">Guitar</a>] - </font>';
}
$sql4 = "SELECT * FROM tabs_tbl WHERE band_id = '.$data['id'].' & filetype = 'lyrics'";
$req4 = mysql_query($sql4) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
$nb4 = mysql_num_rows($req4);
if ($nb4<1) {
echo '';
} else {
echo '<font face="Verdana" size="1">[<a href="tabs_songs.php?id='.$data['id'].'&filetype='.lyrics.'&filetype_name='.Lyrics.'">Lyrics</a>] - </font>';
}
echo '[<a href="bandreviews.php?band_id='.$data['id'].'">Reviews</a>]</font></p>
<div align="center">
<table border="0" width="90%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%"><font face="Verdana" size="1" color="#D0CCD0">'.$data['description'].' </font></td>
</tr>
</table>
</div>
<p align="right" style="margin-top: 5"><font face="Verdana" size="1" color="#000000">[ Rating:
'.$data['vote_avg'].'
Votes: '.$data['nbr_votes'].' ] </font><font face="Verdana" size="1"><a href="javascript:Rate_Band(\'rateband.php?id='.$data['id'].'\')"><u>Rate
Band</u></a></font></p>
<p align="right">';
$nombre=ceil($nb/$limit);
echo "<center>"; if($debut>0)
{
echo "<font face=\"Verdana\" size=\"1\"><a href=bands.php?cat=$cat&debut=".($debut-$limit). "><<</a> </font> ";
}
if ($nombre>1)
{ for($i=1; $i<=$nombre; $i++)
{
echo "<font face=\"Verdana\" size=\"1\"><a href=bands.php?cat=$cat&debut=".(($i-1)*$limit). ">".$i. "</a> </font> ";
}
}
if(($debut+$limit)<$nb)
{
echo "<font face=\"Verdana\" size=\"1\"><a href=bands.php?cat=$cat&debut=".($debut+$limit). ">>></a></font>";
}
echo "</CENTER>";
} mysql_close($db);
?>