Greetings!
I'm trying to solve a little problem that occurs when I try to kinda make an associative array out of an associative array. I wish to associate 2 fields coming from mySQL so I can make a simple associated print for the records I want (and I do not wish to print all the records coming from the DB)
Here's my code:
$sql = "SELECT tipo_cont, conteudo_cont FROM CONTACTOS WHERE id_menu = '1'";
$query = mysql_query($sql);
if(!$query)
{
echo "Erro ao executar a query".mysql_error();
}
while($row = mysql_fetch_assoc($query))
{
$cont = array($row['tipo_cont'] => $row['conteudo_cont']);
print_r($cont);
}
echo $cont['Morada'];
So, what I want is field 'tipo_cont' to index the respective DB field in 'conteudo_cont'.
Would be a lot easier if I didn't wanted just some records to be shown.
Glad for all the possible help
Cheers