Jump to content

[SOLVED] MySQL query displaying 1 row less in Php page


Recommended Posts

Odd thing happening here.  I have a couple of production reports that have got problems with a MySQL query.  I run the qry in Query browser - great, all data shows.  I run it on a report on a PHP page and I get the first row missing.  It started when I began to use <div>'s and css a few months ago but haven't had the time to revisit it, but I've been asked to do some more reports based on it - they like the look and feel of them - so I need to fix it.  Anyone else seen this?  I'm doing the queries EXACTLY as I would in a table, just substituting the table for div's.  I could rebuild it with a static page but I like how it looks and want to crack this issue.  Is it a css issue?  I have lots of static reports pages but really want to move to a more dynamic system.  I've started using PEAR as well although not here.

 

It's not a browser thing - same in IE, FF, Chrom etc.

You would need to post your code to be sure, but I will guess you have a mysql_fetch_xxxxxx() statement right after your mysql_query() statement that is fetching the first row from the result set but you don't use it, then you have a while() loop that contains a mysql_fetch_xxxxxx() statement to retrieve the rest of the rows. If so, why do you have that loan initial mysql_fetch_xxxxxx() statement, that is not doing anything except to discard the first row, in your code???

Yup - that's got it.  I was using a &GET[] to populate the report title row but only using one element  of it then using a query to retrieve the rest - I now see the error of my ways (hangs head in shame) and use the $GET[] to provide the report title and header info (job id, name, date etc) and a MySQL query to get the detail.

 

Many thanks - I was staring at it for a couple of hours yesterday.  What a dipstick!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.