Witam ponownie!
Mam pewien kod PHP:
<?php
$wyciaganie_style = mysql_query('SELECT * FROM `style` ORDER BY `name`') or
die('Wystąpił błąd o treści<br />:'.mysql_error());
switch($_GET['id'])
{
default:
<tr>
<th>Miniaturka</th>
<th>Informacje</th>
<th>Pobierz</th>
</tr>');
{
<td><a href="themes.php?id='.$wyciaganie_style_txt['id'].'"><img src="'.$wyciaganie_style_txt['pole1'].'" alt="'.$wyciaganie_style_txt['name'].'" border="0" /></a></td>
<td>Nazwa motywu: <a href="themes.php?id='.$wyciaganie_style_txt['id'].'">'.$wyciaganie_style_txt['pole2'].'</a><br />
Autor: '.$wyciaganie_style_txt['pole3'].'<br />
Licencja: '.$wyciaganie_style_txt['pole4'].'<br />
Dodano: '.$wyciaganie_style_txt['pole5'].'
</td>
<td><a href="'.$wyciaganie_style_txt['pole6'].'">Pobierz</a></td>
</tr>');
}
</div>'
);
break;
case 2:
<h3>Pobierz motyw: '.$wyciaganie_style_txt['pole1'].'</h3>
<p><strong>Autor motywu: </strong>'.$wyciaganie_style_txt['pole2'].'
<p><strong>Opis motywu: </strong>'.$wyciaganie_style_txt['pole3'].'</p>
<p><strong>Licencja: </strong>'.$wyciaganie_style_txt['pole4'].'</p>
<p><strong>Buttony: </strong>'.$wyciaganie_style_txt['pole5'].'</p>
<p><strong>Live demo: </strong>'.$wyciaganie_style_txt['pole6'].'</p>
<p><strong>Screeny: </strong></p>
<p><a href="'.$wyciaganie_style_txt['pole7'].'" title=""><img src="'.$wyciaganie_style_txt['pole8'].'" border="0" alt="" /></a></p>
<p class="float-right"><a href="'.$wyciaganie_style_txt['pole9'].'"><img src="images/download.png" alt="" border="0" /></a></p>
</div>');
break;
}
?>
Jak widać, wyciągam pewne dane z bazy. W bloku switch-case default to lista, która wyświetla się jak najbardziej prawidłowo, a kolejne kroki to poszczególne style. I tutaj pojawia się moje pytanie. Czy da się zrobić, bym nie musiał pisać wielu case, tylko np.
case $wyciaganie_style_txt['id']:
//cośtam
? Próbowałem już tak zrobić, jednakże po próbie przejścia do strony stylu wyświetlała się tylko lista.
Z góry dzięki za pomoc.
Pozdrawiam,
hippie