if ($array == false)
if ($array == false)
macchè, ho provato così e dà lo stesso link vuoto
dettagli.php?id=&sottocategoria=
<a href="dettagli.php?id=<?
$query = "select * from tab where categoria = '$array[categoria]' and id > '$id' ORDER BY id ASC LIMIT 1";
$dati = mysql_query($query);
$array = mysql_fetch_array($dati);
print $array[id];
if ($array == false) {
$query = "select * from tab where categoria = '$array[categoria]' ORDER BY id ASC LIMIT 1";
$dati = mysql_query($query);
$array = mysql_fetch_array($dati);
print $array[id];
}
?>&categoria=<?php print $array[categoria]?>">vai al record di categoria successivo</a>
ciao,
secondo me non è un problema di php ma di mysql. Dovresti dividere la tabella in due: una per i nomi e una per i colori le metti in relazione, cosi pui ottenere tutti gli incroci che vuoi in modo semplice.
vedi un pò questo link http://www.html.it/articoli/normaliz...ti-in-mysql-1/
![]()
prova così
Codice PHP:if ($array === false) {
...
provato, a fine categoria mi dà sempre--> dettagli.php?id=&sottocategoria=
spero di aver inteso bene quello che vuoi fare
Codice PHP:$query_par = "select min(id) as min from tab where categoria = '$categoria'";
$par = mysql_query($query_par) or die("Query $query_par non riuscita: " .mysql_error());
$list_par = mysql_fetch_array($par);
$min = $list_par['min'];
$query_dati = "select * from tab where categoria='$categoria' and id > $id order by id ASC LIMIT 1";
$dati = mysql_query($query_dati) or die("Query $query_dati non riuscita: " . mysql_error());
$num = mysql_num_rows($dati);
if ($num > 0) {
$list_dati = mysql_fetch_array($dati);
$id = $list_dati['id'];
}
else {
$id = $min;
}
echo "<a href=\"go.php?id=$id&categoria=$categoria\">vai al record di categoria successivo</a>";
ragazzi FANTASTICOOOOOOOOOO
funziona alla grande!!!!
caro clasku sei mitico, ti devo una birra, come facciamo? :-))