DEV Community

admindatafinder
admindatafinder

Posted on

React first row missing on mysql search

Hello there!
my first post.

I'm trying to figure out a bug in my site that does not show the first row on any of the searches in the mysql database.

I'm using react / nodejs / mysql.

Can anyone help? is there an know issue or something?
what information you need to help me out?
thanks!

Top comments (8)

Collapse
 
jamesrweb profile image
James Robb •

What is the SQL statement you’re running and how are you executing it?

Collapse
 
admindatafinder profile image
admindatafinder •

Hello James,
the SQL statement is not the problem. I over tested it several times and im sure it is bringing everyting.
When I do a count, giving a where clause ='value' it brings me the result 5. when I do a select * it brings me the 5 rows.
running the same statement in react, it brings me 4 rows.

while I was wrinting, i was thinking I never took out the ORDER BY from the react code and never used it on my tests in mysql.
I dont think that's it, but I'll give an shot...

any other considerations I might be missing?

Thanks!

Collapse
 
jamesrweb profile image
James Robb •

If it’s not the sql then it’s your Code, not react. Send the snippet you’re using.

Thread Thread
 
Sloan, the sloth mascot
Comment deleted
 
jamesrweb profile image
James Robb •

This looks like you're executing 2 different queries. The first is retrieving a list of something and the other is returning the same user multiple times for some reason.

Can you share your queries? I bet you anything there is either middleware causing the issue or the query is just wrong.

Thread Thread
 
Sloan, the sloth mascot
Comment deleted
 
jamesrweb profile image
James Robb •

Honesty not sure what’s happening here, have you got your project in a GitHub repo perhaps with a link to the files you run this in?

Thread Thread
 
admindatafinder profile image
admindatafinder •

James, I found out.
It was on a LIMIT at the final:
Working: LIMIT ${pagina}, 50;,callback);
not working: LIMIT ${pagina} ,50;
;

I did removed the LIMIT from not working portion and now is doing what's it supposed to do..
Thanks for your help!