Hi All,
I am new to php and mysql and started learning. I have a small prob with the below queries. Plz have a look and do me the needful or give me a suggestion.
Below is my code to add the two different query results into one. This is working fine when both the queries have same no.of rows.
eg: row1 = 1 2 3 (Query1)
row2 = 3 5 5 (Query2)
o/p: 4 7 8
Let’s say, I have few rows which are not exactly matched with first query.
eg: row1 = 1 2 3 2 (Query1)
row2 = 3 empty empty 5 (Query2)
o/p : 4 2 3 7 (I want the o/p to be like this)
empty means there is no data from the second query.
In my while, && working fine when the 2 queries have same no.of rows.
while (($row1 = mysql_fetch_assoc($rs1)) && ($row2 = mysql_fetch_assoc($rs2)))
{
$strHtml .= “
$strHtml .= “
$strHtml .= “
$strHtml .= “
$strHtml .= “
$strHtml .= “
$strHtml .= “
}
Is the while loop i am using correct or there is any other better solution for this?
please help me, Thanks in advance.