0
Changed further inside the title yet, the case works but does not display the result.
<?php
$sql = "SELECT tipo FROM publicidade WHERE posicao='Lateral' ORDER BY RAND() LIMIT 1";
$stmt = DB::prepare($sql);
$stmt->execute();
$exibe = $stmt->fetchAll();
foreach ($exibe as $u) {
$tipo = $u->tipo; // <-- corrigido baseado nos comentarios
switch ($tipo) {
case 'imagem':
echo "<img src='img/publicidade/$u->idpublicidade/$u->imagem' heigth='150' width='100%'>";
break;
case 'flash':
echo "<embed src='img/publicidade/$u->idpublicidade/$u->flash' width='720' height='90'></embed>";
break;
case 'codigo':
echo "$u->codigo";
break;
}}
altered
Please avoid long discussions in the comments; your talk was moved to the chat
– Maniero