Hi
Could someone help me in identifying the location of the bold code to be insert. i want to insert into database the user log either php var $type='no features' or 'full features' depending on the user choice. Currently when I run, it stores $type='full features' eventhought I click on no features.
Please help
thansk
nma
[PHP]
$movies = $db->get_results("select * from Movie" . $where . $ordered);
if(!$movies)
{
echo '<td valign="top" class="movielistTablemargin">';
echo '<h3 style="color:red;font-align:center;">There are no movies matching your selection.</h3>';
} else
{
echo '<td align="right" valign="top" class="movielistTablemargin">';
foreach($movies as $movie) {
?>
<table width="400" border="0" cellspacing="2" cellpadding="1">
<tr>
</tr>
<?php
if($movie->feature == 0)
{
$type = 'no features';
?>
<tr bgcolor="#f5e9dc" onMouseOver="this.bgColor='#e9d7c4';" onMouseOut="this.bgColor='f5e9dc';" onClick="document.location='/moviebrowser/MB2searchNon.php?movieID=<?php echo $movie->movieID?>'" style="cursor:pointer;">
<td width="50" valign="top"><img src="<?php echo $movie->filmPoster; ?>" width="50" height="65" border="1" vspace="2"/></td>
<td width="350" align="left" class="movielistText"><b>
<?php echo $movie->movieTitle;?></b> (<?php echo $movie->year;?>) <font size="1" color="white" style="background-color:red"><?php echo $movie->features;?></font><br />Directed by:
<?php
$directs = $db->get_results("select directorName from Director where directorID in (select directorID from MovieDirector where movieID = '" . $movie->movieID . "')");
foreach ($directs as $direct) {
echo " - ";
echo $direct->directorName;
}
?>
<br/>Genre:
<?php
$genres = $db->get_results("select genreName from Genre where genreID in (select genreID from MovieGenre where movieID = '" . $movie->movieID . "')");
foreach ($genres as $genre) {
echo " - " . $genre->genreName;
}
?>
</td>
</tr>
<tr>
<td colspan="3" height="5"><img src="movielist-separator.jpg" width="386" height="1"/></td>
</tr>
<?php
}
else {
$type = 'full features';
?>
<tr bgcolor="#f5e9dc" onMouseOver="this.bgColor='#e9d7c4';" onMouseOut="this.bgColor='f5e9dc';" onClick="document.location='/moviebrowser/MB2search.php?movieID=<?php echo $movie->movieID?>'" style="cursor:pointer;">
<td width="50" valign="top"><img src="<?php echo $movie->filmPoster; ?>" width="50" height="65" border="1" vspace="2"/></td>
<td width="350" align="left" class="movielistText"><b>
<?php echo $movie->movieTitle;?></b> (<?php echo $movie->year;?>) <font size="1" color="white" style="background-color:red"><?php echo $movie->features;?></font><br />Directed by:
<?php
$directs = $db->get_results("select directorName from Director where directorID in (select directorID from MovieDirector where movieID = '" . $movie->movieID . "')");
foreach ($directs as $direct) {
echo " - ";
echo $direct->directorName;
}
?>
<br/>Genre:
<?php
$genres = $db->get_results("select genreName from Genre where genreID in (select genreID from MovieGenre where movieID = '" . $movie->movieID . "')");
foreach ($genres as $genre) {
echo " - " . $genre->genreName;
}
?>
</td>
</tr>
<tr>
<td colspan="3" height="5"><img src="movielist-separator.jpg" width="386" height="1"/></td>
</tr>
<?php
}
?>
</table>
<?php
}
//to insert user log into database
$db->query("INSERT INTO LogsTableMainscreen (page, action, userID, type, date) VALUES ('movie features', 'click', " . $_SESSION['user']->userID . ", '$type', getDate())");
}
?>
[/PHP]