POUR UN Webmaster chevronné
Je suis vraiment dans une impasse
Quand jais un seul enregistrement sur ma base de donné ya une photo qui s’affiche sur ma page est quand je clic sur la photo jais un lien ( music.php?id= ) le N° <id> ne s’affiche pas
Est quand jais 2 enregistrement sur ma base le 2 em marche avec le N° <id>= 1 est le 1er ne marche pas id=…… ?
-----------------------------------------------------------------------------------------------------
$pas = 10;//nbr de ligne par col
$col =3;//nbr de col par ligne
if (array_key_exists("start",$_GET))
{
$start=$_GET['start'];
$limit=$start-$pas;
}
else
{
$limit=1;
$start=0;
}
$db_name = "musicportal"; //mysql name
$db_host = "localhost"; //mysql host
$db_user = "root"; //mysql user
$db_pass = ""; //mysql password
mysql_connect($db_host,$db_user,$db_pass) or die(mysql_error());
mysql_select_db($db_name) or die(mysql_error());
$result = mysql_query("SELECT * FROM mp3 order by id desc limit $start,$pas");
$resultNav = mysql_query("SELECT * FROM mp3 order by id desc ");
$nbrNav = mysql_num_rows($resultNav);
$nbr = mysql_num_rows($result);
$page = ($start/$pas)+1;
$sur = ceil($nbrNav/$pas);
echo "<table align='center'><tr><td class='text' width='50%' align='left'> Nombre d'articles dans cette rubrique :<b>$nbrNav</b></td><td class='text' align='right'>Page $page sur $sur</td></tr></table>";
echo'<table border="0" align="center" cellpadding="10" cellspacing="0">';
$ligne = 1;
while (($res=mysql_fetch_array($result) )and ($nbr>=$col)){
echo "<tr valign=\"top\">";
for($i=0; $i<$col; $i++ ){
$album=$res["album"];
$artist=$res["artist"];
$id=$res["id"];
$img=$res["img"];
$date=$res["date"];
$j=$i+$ligne;?>
<td><table width="120">
<tr>
<td width="96" rowspan="4" valign="middle" ><div align="center"><a href="music.php?id=<?=$id?>"><? echo "<img border='0' src="; if ($img=="") { echo 'images/nopic.gif'; } else { echo "\"$img\""; } echo" width='70' height='60' border='0' title='Cliquez Ici pour ecoutez'>"; ?></a></div></td>
<td width="1" height="18" ></td>
<td width="176" valign="top" >Artist :<?=$artist?></td>
</tr>
<tr>
<td width="1" height="18" ></td>
<td valign="top" >Album :
<?=$album?> </td>
</tr>
<tr>
<td width="1" height="18" ></td>
<td valign="top" >Ajoutée le :
<?=$date?> </td>
</tr>
<tr>
<td width="1" height="19" ></td>
<td valign="top" ><div align="left"> Album <?=$album?> </div> </td>
</tr>
<tr>
<td height="1" colspan="3" valign="top" ><img src="images/m41.gif" width="150" height="4" /></td>
</tr></table></td>
<?php
if ($i+$ligne < $nbr) {$res=mysql_fetch_array($result); }
}
$nbr-=$col;
$ligne+=$col;
echo "</tr>";
}
if ($nbr){
echo "<tr>";
for ($i=0;$i<$nbr;$i++){
$res=mysql_fetch_array($result);
$album=$res["album"];
$artist=$res["artist"];
$id=$res["id"];
$img=$res["img"];
$date=$res["date"];
?>
<td><table width="120">
<tr>
<td width="96" rowspan="4" valign="middle" ><div align="center"><a href="music.php?id=<?=$id?>">
<? echo "<img border='0' src="; if ($img=="") { echo 'images/nopic.gif'; } else { echo "\"$img\""; } echo" width='70' height='60' border='0' title='Cliquez Ici pour ecoutez'>"; ?></a></div></td>
<td width="1" height="18" ></td>
<td width="176" valign="top" >Artist :
<?=$artist?></td>
</tr>
<tr>
<td width="1" height="18" ></td>
<td valign="top" >Album :
<?=$album?> </td>
</tr>
<tr>
<td width="1" height="18" ></td>
<td valign="top" >Ajoutée le :
<?=$date?> </td>
</tr>
<tr>
<td width="1" height="19" ></td>
<td valign="top" ><div align="left"> Album <?=$album?> </div> </td>
</tr>
<tr>
<td height="1" colspan="3" valign="top" ><img src="images/m41.gif" width="150" height="4" /></td>
</tr></table></td>
<?php
}
echo "</tr>";
}
echo '</table>';
echo '<table align="center"><tr><td>';
if ($start>=$pas)
{
$limit=$start-$pas;
if ($start>0) echo "<a href='index.php?start=".$limit."' class='text'>Précédent</a> ";
$start+=$pas;
if (($start<=$nbrNav) ) echo "<a href='index.php?start=".$start."' class='text'>Suivant</a>";
}
//$start+=3;
if ($start==0)
{
$start+=$pas;
if (($start < $nbrNav) ) echo "<a href='index.php?start=".$start."' class='text'>Suivant</a>";
}
echo '</td></tr></table>';
Quand jais un seul enregistrement sur ma base de donné ya une photo qui s’affiche sur ma page est quand je clic sur la photo jais un lien ( music.php?id= ) le N° <id> ne s’affiche pas
Est quand jais 2 enregistrement sur ma base le 2 em marche avec le N° <id>= 1 est le 1er ne marche pas id=…… ?
-----------------------------------------------------------------------------------------------------
$pas = 10;//nbr de ligne par col
$col =3;//nbr de col par ligne
if (array_key_exists("start",$_GET))
{
$start=$_GET['start'];
$limit=$start-$pas;
}
else
{
$limit=1;
$start=0;
}
$db_name = "musicportal"; //mysql name
$db_host = "localhost"; //mysql host
$db_user = "root"; //mysql user
$db_pass = ""; //mysql password
mysql_connect($db_host,$db_user,$db_pass) or die(mysql_error());
mysql_select_db($db_name) or die(mysql_error());
$result = mysql_query("SELECT * FROM mp3 order by id desc limit $start,$pas");
$resultNav = mysql_query("SELECT * FROM mp3 order by id desc ");
$nbrNav = mysql_num_rows($resultNav);
$nbr = mysql_num_rows($result);
$page = ($start/$pas)+1;
$sur = ceil($nbrNav/$pas);
echo "<table align='center'><tr><td class='text' width='50%' align='left'> Nombre d'articles dans cette rubrique :<b>$nbrNav</b></td><td class='text' align='right'>Page $page sur $sur</td></tr></table>";
echo'<table border="0" align="center" cellpadding="10" cellspacing="0">';
$ligne = 1;
while (($res=mysql_fetch_array($result) )and ($nbr>=$col)){
echo "<tr valign=\"top\">";
for($i=0; $i<$col; $i++ ){
$album=$res["album"];
$artist=$res["artist"];
$id=$res["id"];
$img=$res["img"];
$date=$res["date"];
$j=$i+$ligne;?>
<td><table width="120">
<tr>
<td width="96" rowspan="4" valign="middle" ><div align="center"><a href="music.php?id=<?=$id?>"><? echo "<img border='0' src="; if ($img=="") { echo 'images/nopic.gif'; } else { echo "\"$img\""; } echo" width='70' height='60' border='0' title='Cliquez Ici pour ecoutez'>"; ?></a></div></td>
<td width="1" height="18" ></td>
<td width="176" valign="top" >Artist :<?=$artist?></td>
</tr>
<tr>
<td width="1" height="18" ></td>
<td valign="top" >Album :
<?=$album?> </td>
</tr>
<tr>
<td width="1" height="18" ></td>
<td valign="top" >Ajoutée le :
<?=$date?> </td>
</tr>
<tr>
<td width="1" height="19" ></td>
<td valign="top" ><div align="left"> Album <?=$album?> </div> </td>
</tr>
<tr>
<td height="1" colspan="3" valign="top" ><img src="images/m41.gif" width="150" height="4" /></td>
</tr></table></td>
<?php
if ($i+$ligne < $nbr) {$res=mysql_fetch_array($result); }
}
$nbr-=$col;
$ligne+=$col;
echo "</tr>";
}
if ($nbr){
echo "<tr>";
for ($i=0;$i<$nbr;$i++){
$res=mysql_fetch_array($result);
$album=$res["album"];
$artist=$res["artist"];
$id=$res["id"];
$img=$res["img"];
$date=$res["date"];
?>
<td><table width="120">
<tr>
<td width="96" rowspan="4" valign="middle" ><div align="center"><a href="music.php?id=<?=$id?>">
<? echo "<img border='0' src="; if ($img=="") { echo 'images/nopic.gif'; } else { echo "\"$img\""; } echo" width='70' height='60' border='0' title='Cliquez Ici pour ecoutez'>"; ?></a></div></td>
<td width="1" height="18" ></td>
<td width="176" valign="top" >Artist :
<?=$artist?></td>
</tr>
<tr>
<td width="1" height="18" ></td>
<td valign="top" >Album :
<?=$album?> </td>
</tr>
<tr>
<td width="1" height="18" ></td>
<td valign="top" >Ajoutée le :
<?=$date?> </td>
</tr>
<tr>
<td width="1" height="19" ></td>
<td valign="top" ><div align="left"> Album <?=$album?> </div> </td>
</tr>
<tr>
<td height="1" colspan="3" valign="top" ><img src="images/m41.gif" width="150" height="4" /></td>
</tr></table></td>
<?php
}
echo "</tr>";
}
echo '</table>';
echo '<table align="center"><tr><td>';
if ($start>=$pas)
{
$limit=$start-$pas;
if ($start>0) echo "<a href='index.php?start=".$limit."' class='text'>Précédent</a> ";
$start+=$pas;
if (($start<=$nbrNav) ) echo "<a href='index.php?start=".$start."' class='text'>Suivant</a>";
}
//$start+=3;
if ($start==0)
{
$start+=$pas;
if (($start < $nbrNav) ) echo "<a href='index.php?start=".$start."' class='text'>Suivant</a>";
}
echo '</td></tr></table>';
Configuration: Windows Vista Internet Explorer 7.0