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
potreb
post
Post #2





Grupa: Zarejestrowani
Postów: 1 568
Pomógł: 192
Dołączył: 7.03.2005
Skąd: Warszawa

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


  1. <?php
  2. if(!$_GET['nr'])
  3. {
  4. echo '<img border="0" src="pic/1.jpg" alt="">';
  5. // jeżeli nie pobrano nr obrazka to wyświetli sie ten
  6.  
  7. } else {
  8. echo '<img border="0" src="pic/'.$nr.'.jpg" width="500" height="375" alt="">';
  9. }
  10. ?>


Ze wstawieniem to sobie już poradzisz

Ten post edytował potreb 3.01.2008, 20:35:18
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: 5.10.2025 - 10:01