andreia_sampa Posted January 28, 2012 Report Share Posted January 28, 2012 Oi me ajudem aki nessse codigo?? O q ta errado??!!Obrgdas<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><title>Série Faca um Site - PHP 5 com MySQL</title></head><?PHPinclude "estilo1.inc";include "dbConexao.php";$sql = "SELECT categoria.cat_nome, miniaturas.* ";$sql = $sql . " FROM categorias ";$sql = $sql . " INNER JOIN miniaturas ";$sql = $sql . " ON categorias.id = miniaturas.id_categoria ";$sql = $sql . " WHERE categorias.cat_nome = 'Aviões'";$rs = mysql_query($sql, $conexao);$total_registros = mysql_num_rows($rs);?><body><p>Sentenca SQL desse laboratorio:<strong><?PHP print $sql; ?></strong><br />Total de registros retornados pela consulta: <strong><?PHP print$total_registros; ?></strong></p><table cellspacing="0"><thead><tr><td>Nome</td><td>Cat </td><td>Cor</td><td align="right">Preço</td></tr></thead><?PHPwhile ($reg = mysql_fetch_array($rs)) {$nome = $reg["nome"];$cor = $reg["cor"];$id_categoria = $reg["cat_nome"];$preço = $reg["preço"];?><tr><td><?PHP print $nome; ?></td><td><?PHP print $cor; ?></td><td><?PHP print $id_categoria; ?></td><td align="right">R$ <?PHP print number_format($preço,2,',','.');?></td></tr><?PHP}?><table></body></html><?PHPmysql_free_result($rs);mysql_close($conexao);?> Quote Link to comment Share on other sites More sharing options...
0 ESerra Posted January 28, 2012 Report Share Posted January 28, 2012 E erro que retorna é qual? Quote Link to comment Share on other sites More sharing options...
Question
andreia_sampa
Oi me ajudem aki nessse codigo?? O q ta errado??!!
Obrgdas
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Série Faca um Site - PHP 5 com MySQL</title>
</head>
<?PHP
include "estilo1.inc";
include "dbConexao.php";
$sql = "SELECT categoria.cat_nome, miniaturas.* ";
$sql = $sql . " FROM categorias ";
$sql = $sql . " INNER JOIN miniaturas ";
$sql = $sql . " ON categorias.id = miniaturas.id_categoria ";
$sql = $sql . " WHERE categorias.cat_nome = 'Aviões'";
$rs = mysql_query($sql, $conexao);
$total_registros = mysql_num_rows($rs);
?>
<body>
<p>Sentenca SQL desse laboratorio:<strong><?PHP print $sql; ?></
strong><br />
Total de registros retornados pela consulta: <strong><?PHP print
$total_registros; ?></strong></p>
<table cellspacing="0">
<thead>
<tr>
<td>Nome</td>
<td>Cat </td>
<td>Cor</td>
<td align="right">Preço</td>
</tr>
</thead>
<?PHP
while ($reg = mysql_fetch_array($rs)) {
$nome = $reg["nome"];
$cor = $reg["cor"];
$id_categoria = $reg["cat_nome"];
$preço = $reg["preço"];
?>
<tr>
<td><?PHP print $nome; ?></td>
<td><?PHP print $cor; ?></td>
<td><?PHP print $id_categoria; ?></td>
<td align="right">R$ <?PHP print number_format($preço,2,',','.');
?></td>
</tr>
<?PHP
}
?>
<table>
</body>
</html>
<?PHP
mysql_free_result($rs);
mysql_close($conexao);
?>
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.