Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php][mysql]Ustawienie domyslnego zdjęcia, oraz pobieranie danych z MySQL, tabela
faflok
post
Post #1





Grupa: Zarejestrowani
Postów: 19
Pomógł: 0
Dołączył: 3.01.2008

Ostrzeżenie: (0%)
-----


Mam taki kod:

Kod
<table border="1" width="100%">
    <tr>
        <td>
        <p align="center">
        <img border="0" [b]src="pic/<? echo $nr; ?>.jpg"[/b] width="500" height="375"></td>
    </tr>
</table>
<table border="1" width="100%">
    <tr>
        <td>
        <p align="center">
        <a target="_self" [b]href="index.php?nr=1">[/b]
        <img border="0" src="pic/1.jpg" width="150" height="112"></a></td>
        <td>
        <p align="center">
        <a target="_self" [b]href="index.php?nr=2"[/b]>
        <img border="0" src="pic/2.jpg" width="150" height="112"></a></td>
        <td>
        <p align="center">
        <a target="_self" [b]href="index.php?nr=3"[/b]>
        <img border="0" src="pic/3.jpg" width="150" height="112"></a></td>
    </tr>
</table>


Po otwarciu strony widze tylko ikonki, nie ma żadnego głownego zdjecia. Jak tu ustawić pierwsze domyślne zdjęcie?

Jeszcze jedno z innej półki: po pobraniu danych z bazy danych MySQL, umiem wyświetlić dane w formie tabeli, która składa się z jednej kolumny. Chce by kolumn było 4. Poniżej fragment kodu:

Kod
<table>

<?php
$videolist = @mysql_query($select . $from . $where);
if (!$videolist) {
  echo '</table>';
  exit('<p>Video can not be load!!<br />'.
      'Error: ' . mysql_error() . '</p>');
}

while ($vid = mysql_fetch_array($videolist)) {
  $data = $vid['data'];
  $zdjecie = $vid['photo'];
  $tytul = $vid['titel'];
  $link = $vid['link'];
echo "<tr valign='top'>\n";
  echo "<img src='$zdjecie' width='80' height='60' >";
  echo "<a href='index.php?videoId=$link' target='_parent'>".
             "Added: $data" .
             "<a href='index.php?videoId=$link' target='_parent'>PLAY NOW!</a>\n";

}
?>

</table>
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
faflok
post
Post #2





Grupa: Zarejestrowani
Postów: 19
Pomógł: 0
Dołączył: 3.01.2008

Ostrzeżenie: (0%)
-----


Robiłem podobnie i nic.

Tutaj zobaczysz jak to działa

A kod wygląda tak:
Kod
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>

<body>
<table border="1" width="100%">
    <tr>
        <td>
        <p align="center">
        <?php
if(!$_GET['nr'])
{
echo '<img border="0" src="pic/'.$nr.'.jpg" width="500" height="375" alt="">';
} else {
echo '<img border="0" src="pic/1.jpg" alt="">';
// jezeli nie pobrano nr obrazka to wyswietli sie ten
}
?>        </p></td>
    </tr>
</table>
<table border="1" width="100%">
    <tr>
        <td>
        <p align="center">
        <a target="_self" href="index.php?nr=1">
        <img border="0" src="pic/1.jpg" width="150" height="112"></a></td>
        <td>
        <p align="center">
        <a target="_self" href="index.php?nr=2">
        <img border="0" src="pic/2.jpg" width="150" height="112"></a></td>
        <td>
        <p align="center">
        <a target="_self" href="index.php?nr=3">
        <img border="0" src="pic/3.jpg" width="150" height="112"></a></td>
    </tr>
</table>

</body>

</html>
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 16.10.2025 - 12:37