Jump to content


Whats wrong?


5 replies to this topic

#1 ian mullen

    Young Padawan

  • Members
  • Pip
  • 22 posts
  • Location:UK
  • Interests:Television, Computers, Internet.

Posted 01 December 2006 - 12:56 PM

if (@$d == "m")
{
print "<table width='440' cellspacing='0' cellpadding='0' align='left' style='color: #897048'>";
print "<tr><td height='30' align='left' valign='middle'><strong><u>Episode Music</u></strong></td></tr>";
$sql = mysql_query("SELECT * FROM episodes_music WHERE tvshow = '$tvshow' AND episode_id = '$e' ORDER BY music_title");
print "<tr><td align='justify'>";
print "<table width='440' border='0' cellspacing='8' cellpadding='2'>";
while($body = mysql_fetch_array($sql))
{
$result = mysql_query("SELECT * FROM episodes_music WHERE episode_id = '$e'");
$numrecords = mysql_num_rows($result);
if ($numrecords == 0)
{
print "<tr><td>There is currently no known music for this episode, or none was used. If you know of music used in the episode, let us know by clicking <a href='contact.html'>HERE</a>.</td></tr>";
}
else {
extract($body);
print "<tr>";
print "<td>'$music_title'</td>";
print "<td align='left'><b>by</b></td>";
print "<td>$music_artist</td>";
print "</tr>";
}
}
print "</table>";
}




I can't see anything wrong, but it won't print the message when there are no records in the table.

Basically, what I need it to do is to print a message if there are no records matching a specific episode ID but if there are records, I need it to print these records.

So if I have episode id 919 with 8 records, I need it to print those 8 records. If I have episode id 912 with 0 records, I need it to print my message There is currently no known music for this episode, or none was used. If you know of music used in the episode, let us know by clicking <a href='contact.html'>HERE</a>.


Hopefully that will help!
Thanks in advance!

Edited by Mr. Matt, 01 December 2006 - 02:13 PM.


#2 Mr. Matt

    Moderator

  • P2L Staff
  • PipPipPipPip
  • 1,945 posts
  • Gender:Not Telling

Posted 01 December 2006 - 02:20 PM

Lets see what this returns:

<?php

if ($d == "m") {

	print "<table width='440' cellspacing='0' cellpadding='0' align='left' style='color: #897048'>";
	print "<tr><td height='30' align='left' valign='middle'><strong><u>Episode Music</u></strong></td></tr>";
	print "<tr><td align='justify'>";
	print "<table width='440' border='0' cellspacing='8' cellpadding='2'>";

	$sql = mysql_query("SELECT * FROM `episodes_music` WHERE `tvshow` = '".$tvshow."' AND `episode_id` = '".$e."' ORDER BY `music_title`") OR die(mysql_error());
		if (mysql_num_rows($sql) > 0) {
			while($body = mysql_fetch_array($sql)) {
				$result = mysql_query("SELECT * FROM `episodes_music` WHERE `episode_id` = '".$e."'") OR die(mysql_error());
					$numrecords = mysql_num_rows($result);
						if (mysql_num_rows($result) > 0) {
							extract($body);
							print "<tr>";
							print "<td>'$music_title'</td>";
							print "<td align='left'><b>by</b></td>";
							print "<td>$music_artist</td>";
							print "</tr>";
						} else {
							print "<tr><td>There is currently no known music for this episode, or none was used. If you know of music used in the episode, let us know by clicking <a href='contact.html'>HERE</a>.</td></tr>";
						}
			}
		} else {
			print "<tr><td>There is episode with this ID.</td></tr>";
		}

	print "</table>";
}

?>

Matt

#3 ian mullen

    Young Padawan

  • Members
  • Pip
  • 22 posts
  • Location:UK
  • Interests:Television, Computers, Internet.

Posted 01 December 2006 - 02:49 PM

Nope - fraid that doesn't work either. Just says there is an unexpected $ on line 337 when line 377 is just ?>

#4 Mr. Matt

    Moderator

  • P2L Staff
  • PipPipPipPip
  • 1,945 posts
  • Gender:Not Telling

Posted 01 December 2006 - 04:15 PM

The unexpected $ means that there is an unclosed } somewhere. If your ok with it post the whole code here and I can find the issue for you.

Matt

#5 ian mullen

    Young Padawan

  • Members
  • Pip
  • 22 posts
  • Location:UK
  • Interests:Television, Computers, Internet.

Posted 01 December 2006 - 04:44 PM

There isn't in your coding. 6 opens, 6 closes.

#6 Mr. Matt

    Moderator

  • P2L Staff
  • PipPipPipPip
  • 1,945 posts
  • Gender:Not Telling

Posted 01 December 2006 - 05:04 PM

but is that the whole script...





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users