Jump to content

This is wierd scripted is 100% rigth buth output not


jorn369

Recommended Posts

I got a code that figurse out if the user have watched that movie already or not now the wierd thing about it it let see if he watched buth not if he didnt watched:

 

Code:

$uid = $_COOKIE["cookname"];
$tid = $torrent["id"];
$con = mysql_connect("localhost","jornherm_acbteam","*******");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("jornherm_acbteam", $con);
$query5 = "SELECT uid, tid FROM torrents_seen WHERE uid = '$uid' AND tid = '$tid'";
$gezien = mysql_query($query5);

while($row = mysql_fetch_assoc($gezien))
{
$uid2 = $row['uid'];
$tid2 = $row['tid'];
if (empty($tid2)) 
{
    echo "<img src=\"./images/notseen.png\" border=\"0\">";
} else {
    echo "<img src=\"./images/seen.png\" border=\"0\">";
}
}

 

DB Structure:

 

tid,uid

 

tid=the id of the movie

uid=the username

 

screen655154.png

Link to comment
Share on other sites

Got i solved beceasu ther wasent always a resutl a loop could not started so i did this:

 

<?
$uid = $_COOKIE["cookname"];
$tid = $torrent["id"];
$con = mysql_connect("localhost","jornherm_acbteam","*******");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("jornherm_acbteam", $con);
// select ALL rows
$query = "SELECT * FROM torrents_seen WHERE uid = '$uid' AND tid = '$tid'";
$result = mysql_query($query);

$num_rows = mysql_num_rows($result);
if ($num_rows == 1)
{
echo "<img src=\"./images/seen.png\" border=\"0\">";	

} 	

else 	

{	

echo "<img src=\"./images/notseen.png\" border=\"0\">";	

}


?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.