Hi Guys,
I have a script I coded about 3 years ago, I was hoping to implement it to have an artists A-Z directory listing built into my website, however it isn't working the way it used too!
Could someone maybe give me a hand with this? I'm using PHP 4.4.2 http://bangorfm.co.uk/phpinfo.php for more information.
Page number 1 is to read the artists name from the database and link to the details using 'newsid'
http://www.bangorfm.co.uk/artists.php PAGE 1
<? include "pageheader.php" ?>
<?
$db=mysql_connect("*********","******","*****");
mysql_select_db("********",$db);
?>
<?
if ($newsid == "") {
$sql="SELECT * FROM book1 ORDER BY newsid DESC";
$result=mysql_query($sql);
$ncount=0;
echo "<font size=1> </font>";
while ($myrow=mysql_fetch_array($result)) {
if ($ncount<10)
{
$ncount=$ncount+1;
$newsbody = str_replace("\'", "'", $newsbody);
?>
<a href=readartists.php?&newsid=<? echo $myrow["newsid"]; ?>>
<? echo $myrow["newsname"]; ?></a><br>
<?
}
}
} else {
$sql="SELECT * FROM book1 WHERE newsid=$newsid";
$result=mysql_query($sql);
$myrow=mysql_fetch_array($result);
printf("<div align=left><font face=Verdana size=2><a href=artists.php>BACK TO ARTISTS A/Z</a><br><Br>");
printf("<font size=3 color=#FFfff><b>%s</b></font> <font color=white size=1><b></b></font> <font color=#ffffff size=1></font><font face=Verdana size=2> ", $myrow["newsname"], $myrow["newsby"]);
printf("<Br><Br><font face=Verdana size=2>%s", $myrow["newsbody"]);
}
?>
</body>
</html>
<? include "pagefooter.php" ?>
Then page 2 is located at http://www.bangorfm.co.uk/readartists.php?&newsid=1
Id being 1 which should show the Britney Spears Biography..
HERES PAGE 2
<? include "pageheader.php" ?>
<?
$db=mysql_connect("********","***********","********");
mysql_select_db("*********",$db);
?>
<?
if ($newsid == "") {
$sql="SELECT * FROM book1 ORDER BY newsid DESC";
$result=mysql_query($sql);
$ncount=0;
echo "<font size=1> </font>";
while ($myrow=mysql_fetch_array($result)) {
if ($ncount<10)
{
$ncount=$ncount+1;
$newsbody = str_replace("\'", "'", $newsbody);
?>
<a href=readartists.php?&newsid=<? echo $myrow["newsid"]; ?>>
<? echo $myrow["newsname"]; ?></a><br>
<?
}
}
} else {
$sql="SELECT * FROM book1 WHERE newsid=$newsid";
$result=mysql_query($sql);
$myrow=mysql_fetch_array($result);
printf("<div align=left><font face=Verdana size=2><a href=artists.php>BACK TO ARTISTS A/Z</a><br><Br>");
printf("<font size=3 color=#FFfff><b>%s</b></font> <font color=white size=1><b></b></font> <font color=#ffffff size=1></font><font face=Verdana size=2> ", $myrow["newsname"], $myrow["newsby"]);
printf("<Br><Br><font face=Verdana size=2>%s", $myrow["newsbody"]);
}
?>
</body>
</html>
<? include "pagefooter.php" ?>
As you can see. page 2 simply shows up the same as page 1 ... before it recognized the newsid= tab and took out the rest and used the second set of code..
Can anyone help with this?
Hope it all makes sense!