Ciau a tutti ^^
Codice PHP:
<?
$user = "SELECT * FROM pages WHERE nickname = '$x'";
$risultato = mysql_query($user) or die("Query fallita: " . mysql_error() );
while ($row=mysql_fetch_array($risultato))
{
$str= array($row["musicvideo1"],
$row["musicvideo2"],
$row["musicvideo3"],
$row["musicvideo4"],
$row["musicvideo5"],
$row["musicvideo6"],
$row["musicvideo7"],
$row["musicvideo8"],
$row["musicvideo9"],
$row["musicvideo10"]);
$data= array($row["mvtitle1"],
$row["mvtitle2"],
$row["mvtitle3"],
$row["mvtitle4"],
$row["mvtitle5"],
$row["mvtitle6"],
$row["mvtitle7"],
$row["mvtitle8"],
$row["mvtitle9"],
$row["mvtitle10"]);
?>
<div class="title_menu_hdr_dx">
My Music Video</div>
<div class="my_contents_dx"><? if ($row['musicvideo1'] == ""){ echo $errore_box; } else { foreach($str as $key => $string) {
echo "<a href=\"".$str."\">".$data."</a>
";
<?
} //while chiuso
?>
In poche parole, dalla lettura dei dati con la query vorrei che lo script mi stampasse questo codice a schermo:
" <? echo $row[mvtitle]; ?> "
e questo per tutti i dati (dovrebbero risultare alla fine 10 link). Ho provato a mettere un foreach, anche se nn sn molto sicuro che vada bene. Difatto stampa a schermo la parola "Array" 10 volte :|
Però non è detto che tutti i campi siano riempiti... nel caso nn fossero riempiti e nn ci fosse nessun controllo mi stamperebbe una cosa del genere:
Come si può indicare che deve stampare solo i campi pieni?
Grazie in anticipo