Show data from BD

Asked

Viewed 78 times

0

I’m creating a movie site that should show the trailers and stuff. I want that when adding in the database some movie the script organizes the screen dynamically.

Example: in the database we will have movie name, photo and trailer.

How should I start? If you can’t help me do it, at least tell me what to look for.

Deve ficar assim

  • You mean some way to check in the database if there are changes and then it remove or add the movies without reloading the page?

  • What do you mean "organize"?

  • Experiment with Bootstrap can do all this.

  • If you want to organize the data physically in the database, try to create some index in your tables. Try to detail your question better, because information is missing and causing ambiguity

  • 1

    I will post what I explained here >>> http://pastebin.com/bbtRiiL8

  • 1

    Thank you Marcos Vinicios!! That’s exactly what I wanted hehehe!

Show 1 more comment

1 answer

3


Please note that when you update your database, the data will already be updated when you display your movie query... Now, it all depends on how you’re doing to display your data, to automatically organize the table according to the qtdDeRegistros which you must display on each line, you can do so:

$varConsulta = ConsultaFilmes();
    $i=0;
    if ($varConsulta) {
    echo "<table style='margin-left:2%;'><tr>";
        foreach ($varConsulta as $lin) {
            $linhas .= "<td style='vertical-align: middle;text-align: center;'>Filme<br />[IMAGEM][INFORMAÇÕES REFERENTES AO FILME]</td>";

            echo $linhas;

            $i++;
            //Aqui é feito a mágica!!
            if ($i % $qtdDeRegistros == 0) {
                echo "</tr>";
                echo "<tr>";
            }
        }

        echo "</tr></table>";
    }else{
        echo "<h3> Nenhum filme dísponivel.</h3>";
    }
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.