Hi,
what i'm really trying to find out is how to run 2 queries and get the result of them in a single file.
The code goes Below, the problem is that the printed result comes only from the first query the second query result is displayed as 1st query result.
How can i avoid that?
Thank you.
Ian Heart
<?php
include("connection.php");
$result=mysql_query("SELECT *FROM curso where curso_name='Direito'");
$num=mysql_numrows($result);
$i=0;
while ($row=mysql_fetch_array($result))
{
$curso_name=mysql_result($result,$i,"curso_name");
$curso_periodo=mysql_result($result,$i,"curso_periodo");
$curso_disciplina1=mysql_result($result,$i,"curso_disciplina1");
$curso_disciplina2=mysql_result($result,$i,"curso_disciplina2");
$curso_disciplina3=mysql_result($result,$i,"curso_disciplina3");
$curso_preco=mysql_result($result,$i,"curso_preco");
}
echo $curso_name;
echo $curso_disciplina1;
//second query
$resultnumber=mysql_query("SELECT *FROM curso where curso_name='informatica'");
$num_second=mysql_numrows($resultnumber);
$x=0;
while ($row=mysql_fetch_array($resultnumber2))
{
$curso_name=mysql_result($resultnumber2,$x,"curso_name");
$curso_periodo=mysql_result($resultnumber2,$x,"curso_periodo");
$curso_disciplina1=mysql_result($resultnumber2,$x,"curso_disciplina1");
$curso_disciplina2=mysql_result($resultnumber2,$x,"curso_disciplina2");
$curso_disciplina3=mysql_result($resultnumber2,$x,"curso_disciplina3");
$curso_preco=mysql_result($resultnumber2,$x,"curso_preco");
}
echo $curso_name;
echo $curso_disciplina1;
?>