Code:
<html>
<head>
<title>Movie Details</title>
</head>
<body>
<?php
require('moviesite_connect.php');
function get_director()
{
global $movie_director;
global $director;
$query_d=mysql_query("SELECT full_name FROM people WHERE id='$movie_director' ");
$row_d=mysql_fetch_array($query_d);
extract($row_d);
$director=$full_name;
}
function get_leadactor()
{
global $movie_leadactor;
global $leadactor;
$query_a=mysql_query("SELECT full_name FROM people WHERE id='$movie_director' ");
$row_a=mysql_fetch_array($query_a);
extract($row_a);
$leadactor=$full_name;
}
function calculate_difference($takings,$cost)
{
$difference=$takings-$cost;
if($difference<0)
{
$difference= substr($difference,1);
$font_color='red';
$profit_or_loss='$'.$difference.'m';
}
elseif($difference>0)
{
$font_color='green';
$profit_or_loss='$'.$difference.'m';
}
else
{
$font_color='blue';
$profit_or_loss='Broke even';
}
return "<font color='$font_color'>".$profit_or_loss."</font>";
}
$result=mysql_query("SELECT * FROM movie WHERE id='".$_GET['movie_id']."'");
while($rows=mysql_fetch_array($result))
{
$movie_name=$rows['movie_name'];
$movie_director=$rows ['movie_director'];
$movie_leadactor=$rows ['movie_leadactor'];
$movie_year=$rows ['movie_year'];
$movie_running_time=$rows ['movie_running_time'];
$movie_taking=$rows ['movie_taking'];
$movie_cost=$rows ['movie_cost'];
get_director('$movie_director');
get_leadactor('$movie_leadactor');
}
?>
<tr> <h2><center><?php echo "$movie_name:details"; ?></center></h2> </tr>
<table width='70%' border='0' cellpadding='2' cellspacing='2' align='center'>
<tr>
<th>Movie Title</th>
<th>Year Of Release</th>
<th>Movie Director</th>
<th>Movie Lead Actor</th>
<th>Movie Running Time</th>
<th>Movie Health</th>
</tr>
<?php
$calculate_difference=calculate_difference($movie_takings,$movie_cost)
?>
<tr>
<td><?php echo $movie_name;?></td>
<td><?php echo $movie_year;?></td>
<td><?php echo $director;?></td>
<td><?php echo $leadactor;?></td>
<td><?php echo $movie_running_time;?></td>
<td><?php echo $calculate_difference;?></td>
</tr>
</table>
</body>
</html>
.....problem is, after i run this code there showing an error such as "Notice: Undefined variable: movie_takings in G:\wamp\www\RED BOOK PRACTISE\movie_details.php on line 94
Call Stack" not only the $movie_takinng ,the same error is showing including the other variables separately....can i have solution plzzz...