0
I did a search here and on google to see if it would solve my problem without having to ask a question, but I could not find any solution.
What I am trying to do is create a "related" but without it displays the same post or video in the case. In case I am using the following code:
<?php
if(!@mysql_connect("localhost","root",""))
{
die('oops connection problem ! --> '.mysql_error());
}
if(!mysql_select_db("player"))
{
die('oops database selection problem ! --> '.mysql_error());
}
$query = @mysql_query("SELECT * FROM videopv2 WHERE `videopv2`.`tipo_relacao`= '$tipode' ORDER BY id DESC");
while ($relacionados = @mysql_fetch_object($query)):
?>
<article class="video-preview <?php echo $relacionados->categoria_video; ?>" data-viewkey="6b684234a3" itemscope="itemscope" itemtype="http://schema.org/ImageObject">
<a title="<?php echo $relacionados->titulo_video; ?>" itemprop="url" target="_blank" href="/AP/embed/<?php echo $relacionados->id; ?>">
<img class="media-preview-thumbnail js-resrc js-resrc-lazy" alt="<?php echo $relacionados->titulo_video ?>" itemprop="thumbnailUrl" src="/AP/assets/embed/imgs/<?php echo $relacionados->imagem_video; ?>" data-src="/AP/assets/embed/imgs/<?php echo $relacionados->imagem_video; ?>" />
<h4 class="media-preview-title" itemprop="name"><?php echo $relacionados->titulo_video; ?></h4>
</a>
</article>
<?php endwhile; ?>
It was not clear to me the description of the problem. Important to understand that the mysql_* functions are obsolete.
– Marcos Xavier
@Marcosxavier, for example, I’m accessing a post, and the footer has a part where I display the related posts. In this field, I wanted to know how to search without the same post (which is open on the page). In a matter of mysql_* what method is being used now? , I’m learning php from some old video lessons.
– Thomas Franklin
Use Pdo instead of mysql_*. About the query, you could store the id of the post displayed in a variable and do something like "select * table Where idPostagem != idPostagemAberta"
– Marcos Xavier