montagem de submenu e função
Boa noite galera.
Preciso da ajuda da galera boa no php.
Seguinte,
Estou precisando montar um submenu a partir de um cadastro mas não sei como funciona para fazer.
O código está assim:
<?php
$row = $sql->execute ( "
SELECT
pt.id AS id,
p.propertyoption AS propertyoption,
p.propertytype AS propertytype,
pt.propertytype AS propertytype
FROM
" . $property_table . " p
INNER JOIN
" . $propertytypes_table . " pt ON (p.propertytype=pt.id)
WHERE
p.propertyshow='1' and p.propertyoption='s'", SQL_RETURN_ASSOC );
$num = sizeof ( $row );
for ( $i = 0; $i < $num; ++$i )
{
$id = $row [ $i ] [ "id" ];
$propertytype = $row [ $i ] [ "propertytype" ];
$propertyoption = $row [ $i ] [ "propertyoption" ];
echo "<li><a href=\"index.php?op=search&po=s&pt=$id\">$propertytype</a></li>";
}
?>
Dessa forma ele cria ASSIM: CASA CASA CASA APARTAMENTO APARTAMENTO TERRENO...etc..
Ou seja, cria de um em um de acordo com o que tem cadastrado.
Queria que fosse criado apenas uma opção de cada para montar o menu assim:
Apartamento
Casa
Terreno
Loja
e etc.
e ao clicar aparece os imoveis.
já tentei várias alternativas mas não consegui.
A função é esta:
function execute ( $sql, $type = 0 )
{
if ( $this->isConnected () == FALSE )
{
return FALSE;
}
$tsql = trim ( $sql );
$this->queries [] = $sql;
$q = @mysql_query ( $sql );
if ( $q == FALSE )
{
return FALSE;
}
if ( preg_match ( "/^select/i", $tsql ) )
{
$return = $q;
if ( $type == SQL_RETURN_ASSOC )
{
$return = array ();
while ( $r = @mysql_fetch_assoc ( $q ) )
{
$return [] = $r;
}
}
else if ( $type == SQL_RETURN_ROWS )
{
$return = @mysql_num_rows ( $q );
}
}
else if ( preg_match ( '/^insert/i', $tsql ) )
{
$return = @mysql_affected_rows ();
if ( $type == SQL_RETURN_INSERTID &&
$return > 0 )
{
$return = @mysql_insert_id ();
}
}
else if ( preg_match ( '/^(update|delete)/i', $tsql ) )
{
$return = @mysql_affected_rows ();
}
else
{
$return = TRUE;
}
return $return;
}
Podem me dar uma força. :)
vlw galera
Discussão (1)
Carregando comentários...