ecabrera Posted August 4, 2011 Share Posted August 4, 2011 hello all well i create a script for movies and users have a option to embed movies into my movies page and all the movies are going to be stored into the movieid in my dbtable in phpmyadmin my problem is that the embed movies that are store in my table dont want to display everything displays except the movie // display title echo "<h2><a href='$site/movies?id=$id'>$title</a></h2>"; // display video echo "$movieid"; // display information echo "<b style='float: right;'>$views views</b>"; echo "<b><a href='$site/profile?id=$user_id'>$user_name</a> on $date in $category</b><br /><br />"; echo "$description<br /><br />$keywords"; Link to comment https://forums.phpfreaks.com/topic/243781-help-display-problem/ Share on other sites More sharing options...
phpSensei Posted August 4, 2011 Share Posted August 4, 2011 You have given us very little information here, please post your full code. Link to comment https://forums.phpfreaks.com/topic/243781-help-display-problem/#findComment-1251703 Share on other sites More sharing options...
ecabrera Posted August 4, 2011 Author Share Posted August 4, 2011 <?php $getid = $_GET['id']; if ($getid){ require("scripts/connect.php"); $query = mysql_query("SELECT * FROM movies WHERE id='$getid'"); $numrows = mysql_num_rows($query); if ($numrows == 1){ $row = mysql_fetch_assoc($query); $title = $row['title']; $user_name = $row['user_name']; $keywords = $row['keywords']; $date = $row['date']; $description = $row['description']; $meta_description = "$title by $user_name - $date"; $meta_keywords = "$keywords"; $title = "$title by $user_name Movies"; } else $title = "Movies"; mysql_close(); } else $title = "Movies"; ?> <?php require("styles/top.php"); ?> <?php require("scripts/connect.php"); if ($getid){ echo "<div id='full'>"; echo "<div id='video'>"; $query = mysql_query("SELECT * FROM movies WHERE id='$getid'"); $numrows = mysql_num_rows($query); if ($numrows == 1){ $row = mysql_fetch_assoc($query); $id = $row['id']; $user_id = $row['user_id']; $user_name = $row['user_name']; $title = $row['title']; $description = $row['description']; $keywords = $row['keywords']; $category = $row['category']; $videoid = $row['movieid']; $views = $row['views']; $comments = $row['comments']; $date = $row['date']; $description = htmltext($description); // start right column // end right column // start left column echo "<div id='left'>"; // update the video views $views = $views + 1; mysql_query("UPDATE movies SET views='$views' WHERE id='$id'"); // display title echo "<h2><a href='$site/movies?id=$id'>$title</a></h2>"; // display video echo "$movieid"; // display information echo "<b style='float: right;'>$views views</b>"; echo "<b><a href='$site/profile?id=$user_id'>$user_name</a> on $date in $category</b><br /><br />"; echo "$description<br /><br />$keywords"; // comment section echo "<a name='comments'></a><div style='margin-top: 15px;'> <b class='corners'> <b class='corners1'><b></b></b> <b class='corners2'><b></b></b> <b class='corners3'></b> <b class='corners4'></b> <b class='corners5'></b></b> <div class='cornersfg'> <div class='top'>$title Comments</div> </div> <div class='bottom'>"; // comment button action if ($_POST['commentbtn']){ $comment = $_POST['comment']; if ($comment){ if ($userid != $getid){ $query = mysql_query("SELECT * FROM movie_comments WHERE movie_id='$getid' AND user_id='$userid' AND comment='$comment'"); $numerows = mysql_num_rows($query); if ($numrows != 0){ $commdate = date("F d, Y"); // October 08, 2010 mysql_query("INSERT INTO movie_comments VALUES ('', '$getid', '$userid', '$username', '$comment', '$commdate')"); // email profile owner $webmaster = "admin@*****.com"; $headers = "From: ******<$webmaster>"; $subject = "$username has commented on your profile"; $message = "Hello $firstname $lastname. $username has posted a comment on your movie titled \"$title\" on *****.com"; $message .= " The message $username has posted with is below.\n"; $message .= "\n****************************************************************\n"; $message .= "$comment"; $message .= "\n\n****************************************************************\n\n"; $message .= "Click here to view $username's profile $site/profile?id=$userid\n"; $message .= "Click here to view your movie $site/movies?id=$getid\n"; // send email mail($email, $subject, $message, $headers); $msg = "Your comment has been added and is shown above."; } else $msg = "You can not submit the same comment twice."; } else $msg = "You can not comment on your own movie."; } else $msg = "You did not supply a comment."; } // display comments $perpage = 10; $start = $_GET['s']; if (!$start) $start = 0; $query = mysql_query("SELECT * FROM movie_comments WHERE movie_id='$getid' ORDER BY id DESC LIMIT $start, $perpage"); $numrows = mysql_num_rows($query); if ($numrows > 0){ $next = $start + $perpage; $prev = $start - $perpage; while($row = mysql_fetch_assoc($query)){ $user_id = $row['user_id']; $user_name = $row['user_name']; $comment = nl2br($row['comment']); $date = $row['date']; echo "<b>Posted by <a href='$site/profile?id=$user_id'>$user_name</a> on $date</b><br />"; echo "<div style='margin-left: 10px;'>$comment</div><hr>"; } } else echo "This movie has no comments.<br />"; // end diplay comment area // show comment nav echo "<div style='float: right;'>"; if (!($start <= 0)) echo "<a href='$site/movies?id=$getid&s=$prev#comments'>Previous</a>"; if (!($start > $numrows - $perpage)) echo "<a href='$site/movies?id=$getid&s=$next#comments'>Next</a>"; echo "</div>"; if ($username){ // display comment form echo "<a name='comment-form'></a>"; if ($msg) echo "<b>$msg</b><br />"; echo "<form action='$site/movies?id=$getid#comment-form' method='post'> <table> <tr> <td><textarea name='comment' style='width: 400px; height: 75px;'></textarea></td> </tr> <tr> <td><input type='submit' name='commentbtn' value='Comment'></td> </tr> </table> </form>"; } // end comment box echo "</div> <b class='corners'> <b class='corners5'></b> <b class='corners4'></b> <b class='corners3'></b> <b class='corners2'><b></b></b> <b class='corners1'><b></b></b></b> </div>"; // end comment section echo "</div>"; // end left column } else echo "The movie you were looking for was not found."; // end full and video echo "</div>"; echo "</div>"; } else{ echo "<div id='left'>"; $perpage = 10; $start = $_GET['s']; if (!$start) $start = 0; $next = $start + $perpage; $prev = $start - $perpage; $query = mysql_query("SELECT * FROM movies ORDER BY id DESC"); $numrows = mysql_num_rows($query); if ($numrows > 0){ $query = mysql_query("SELECT * FROM movies ORDER BY id DESC LIMIT $start, $perpage"); // show comment nav echo "<center><div class='pagination'>"; if (!($start <= 0)) echo "<a href='$site/movies?s=$prev'>Previous</a>"; /* $x = 1; for ($i = 0; $i < $numrows; $i += $perpage){ if ($start != $i) echo "<a href='$site/movies?s=$i'>$x</a>"; else echo "<a href='$site/movies?s=$i'><b><u>$x</u></b></a>"; $x++; } */ if (!($start > $numrows - $perpage)) echo "<a href='$site/movies?s=$next'>Next</a>"; echo "</div></center><br />"; while ($row = mysql_fetch_assoc($query)){ $id = $row['id']; $user_id = $row['user_id']; $user_name = $row['user_name']; $title = $row['title']; $description = $row['description']; $keywords = $row['keywords']; $category = $row['category']; $videoid = $row['movieid']; $views = $row['views']; $comments = $row['comments']; $date = $row['date']; //$description = $description.$description.$description; if (strlen($description) >= 100) $description = substr($description, 0, 100)."..."; echo "<div class='movie'> <div class='image'><a href='$site/movies?id=$id'><img src='http://i1.ytimg.com/vi/$movieid/default.jpg'></img></a></div> <div class='info'> <div class='title'><a href='$site/movies?id=$id'>$title</a></div> <div class='description'> $description <br /><br /> <div style='float: left; font-size: 16px;'><a href='$site/profile?id=$user_id'>$user_name</a></div> <div style='float: right; font-size: 16px;'>$category</div> <center>$views views</center> </div> </div> </div>"; } // show comment nav echo "<div class='clear'></div>"; echo "<center><div class='pagination'>"; if (!($start <= 0)) echo "<a href='$site/movies?s=$prev'>Previous</a>"; if (!($start > $numrows - $perpage)) echo "<a href='$site/movies?s=$next'>Next</a>"; echo "</div></center>"; } else echo "There currently are no movies."; echo"</div>"; } mysql_close(); ?> <?php require("styles/bottom.php"); ?> Link to comment https://forums.phpfreaks.com/topic/243781-help-display-problem/#findComment-1251708 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.