Hi Guys,
I am developing a Music Database system.
This is a 'Song.php' page. It will be a Detailed page of a each song. Ex : song.php?id=1
<?php
if(!empty($_GET['id']))
{
$sid = mysql_real_escape_string ($_GET['id']);
}
// if song id is null, user will redirect to the full song list
else
header ("Location: songlist.php");
?>
<?php
// including database connection
include ('datab.php');
$songs = mysql_query("SELECT * FROM `songs` WHERE `id`='$sid'")or die(mysql_error());
if(mysql_num_rows($songs)> 0)
{
while($row = mysql_fetch_array($songs)){
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $row['name']; ?> - Music Onz</title>
</head>
<body>
</body>
<?php
}
}
?>
</html>
I want to add message "Invalid or Deleted" if system return 0 after this code
$songs = mysql_query("SELECT * FROM `songs` WHERE `id`='$sid'")or die(mysql_error());
I know I have to write else part to
if(mysql_num_rows($songs)> 0)
{
but, I have no idea where to place else part :(
Please help me guys