Loop, need help.

Discussion in 'PHP' started by Mortenjan, Jan 24, 2009.

  1. #1
    Hi people.
    I am creating a cinema webpage and could need some help :rolleyes:

    My current page is: http://www.vinstrakino.co.cc/test/


    How can i get the date and time to loop inside each movie title?

    like: http://www.vinstrakino.co.cc/oversikt.html



    My current php code:

    
    <?php
    
    $user="username";
    $password="password";
    $database="database";
    
    mysql_connect(localhost,$username,$password);
    @mysql_select_db($database) or die( "Unable to select database");
    
    $query = "SELECT
    f.film_navn,
    f.film_aldersgrense,
    f.film_spilletid,
    f.film_filmweb,
    f.film_bilde, d.dato,
    k.visning_start_tid,
    k.visning_stop_tid
    
    FROM filmer_visning f
    
    LEFT JOIN
    
    film_dato_visning d
    
    ON
    
    d.film_id = f.film_id
    
    LEFT JOIN
    
    film_klokkeslett_visning k
    
    
    ON
    
    k.film_visning_id = d.film_dato_id
    
    ";
    
    $result=mysql_query($query);
    
    $num=mysql_numrows($result);
    
    mysql_close();
    
    
    $i=0;
    
    while ($i < $num) {
    
    
    $film_navn=mysql_result($result,$i,"film_navn");
    $film_aldersgrense=mysql_result($result,$i,"film_aldersgrense");
    $film_spilletid=mysql_result($result,$i,"film_spilletid");
    $film_filmweb=mysql_result($result,$i,"film_filmweb");
    $film_bilde=mysql_result($result,$i,"film_bilde");
    $film_dato=mysql_result($result,$i,"dato");
    $visning_start_tid=mysql_result($result,$i,"visning_start_tid");
    $visning_stop_tid=mysql_result($result,$i,"visning_stop_tid");
    
    
    echo"
    
    
    <table width='746' height='133' align='center' cellpadding='0' cellspacing='0'>
    <tr>
    <td height='37' colspan='7' valign='top'>&nbsp;</td>
    </tr>
    <tr>
    <td height='35' colspan='7' valign='middle'>$film_navn
    <hr /></td>
    </tr>
    <tr>
    <td width='190' rowspan='3' valign='top' bgcolor='#6B0305'><img src='$film_bilde' alt='$film_bilde' width='190' height='235' /></td>
    <td width='122' align='center' valign='top' bordercolor='#F0F0F0' bgcolor='#790407'><span class='style12'>Aldersgrense:</td>
    <td width='82' height='2' valign='top' bgcolor='#790407'><span class='style12'>Spilltid:</td>
    <td width='68' height='2' valign='top' bgcolor='#790407'><span class='style12'>Filmweb:</td>
    <td width='68' height='2' valign='top' bgcolor='#790407'><span class='style12'>Dato:</td>
    <td width='105' height='2' align='center' valign='top' bgcolor='#790407'><span class='style12'>Klokkeslett:</td>
    <td width='109' align='center' valign='top' bgcolor='#790407'>Ledige billetter:</td>
    </tr>
    <tr>
    <td height='1' align='center' valign='top' bgcolor='#6B0305'>$film_aldersgrense år</td>
    <td rowspan='2' valign='top' bgcolor='#6B0305'>$film_spilletid</td>
    <td rowspan='2' valign='top' bgcolor='#6B0305'><a href='$film_filmweb'>Link</a> </td>
    <td rowspan='2' valign='top' bgcolor='#6B0305'>$film_dato </td>
    <td rowspan='2' align='center' valign='top' bgcolor='#6B0305'>$visning_start_tid</td>
    <td rowspan='2' align='center' valign='top' bgcolor='#6B0305'></td>
    </tr>
    <tr>
    <td height='21' align='center' valign='bottom' bgcolor='#6B0305'><a href='../bestill.html'><img src='../bestill.png' alt='bestill' width='70' height='21' border='0' /></a></td>
    </tr>
    
    
    </table>
    
    
    
    ";
    
    $i++;
    }
    
    ?>
    
    PHP:

    Thanks in advance

    Regards Morten
     
    Mortenjan, Jan 24, 2009 IP