0
I’m new to programming for the web, and I’m having a hard time with this. I’m developing an advertising site and I need to call more than one table on the page.
I made 3 Div’s advertising: Main, Free and General.
I can only show the advertisements of the main, the free and general I can not.
As I’m calling the principal:
<?php
while ($dados=mysql_fetch_array($res))
{
?>
<?php echo $dados['site']?> <br>
<?php echo $dados['descricao']?> <br>
<img src="Painel/fotos/<?php echo $dados['foto']?> /><br>
<?php }?>
I’m trying to do the same thing for the other two divs and I can’t help myself?
Displays the example with two and with the SQL query.
– Jorge B.
Explain what "I can’t" is. Is it wrong? Which one? An important detail, especially for you who are a beginner, is that mysql_* functions have been obsolete since PHP 5.5. Use Mysqli or PDO. See more here: http://www.ultimatephp.com.br/php-por-que-nao-utilizar-funcoes-mysql
– Beraldo
To 'combine' tables in sql you need a
join
orunion
.– rray
I’m taking the data from the group like this: <?php include ("connected.php"); $sql="select * from main"; $res= mysql_query ($sql); ? > .
– Mateuslapa
Try it with $sql1, $sql2 and $sql3 and $res1 $res2 and $res3.
– Jorge B.
Blz, I’ll try, thank you
– Mateuslapa