Curious simple problem, query seems to skip one entry

A

Anonymous

Guest
Hey all,

Been a abit since I have been back, hope everyone is well.

I have a small problem with a query that you would think would return a simple result:

Code:
// user clicks a link to export the data they see into a csv (in this case we are only going to display the data back to the screen... they click the link and assign a variable number in this case (28) to the $eID variable.
$eID='28';
$nquery = "SELECT * FROM expenses LEFT JOIN vexpenses ON vexpenses.veID='$eID'";
echo $nquery;

$nresult=mysql_query($nquery);

while ($nrow = mysql_fetch_array($nresult))
{
echo $nrow['eID'].",".$nrow['vID'].",".$nrow['eCategory'].",".$nrow['vName']."<br>";
}

The query echos back correctly with $eID as 28 now. The results are returned. Hoever, it skips on entry ... for example:

Table: vexpenses
fields: vID, veID, vName, vDesc, vAmount, vSite

vID is the Primary Key
veID is the link to the expenses table where the report generals are stored. veID = eID from the expenses table.

Table: expenses
fields: eID, eCategory, eName, eDetails

eID is the primary key.
eID matches with veID to pull up specific vendors that are linked to this category expense.


Anyonr have a similar problem with the first record seemingly being skipped?
 
My bad .. I was getting a reference from another query that was coming in through an include. The value of nrow was different. Once I cahgned the variables names to more unique sets, script working fine. Just needed to walk through it I guess.

Peace out.
 
hehe... common problem... however its best not to set so many vars in includes... except for those that are used all the time :)
 
ya same happend to me i bet it was this lol $nresult=mysql_query($nquery);
 
Back
Top