Mysql Row Counts [Resolved]

Place for questions and answers for all newcomers and new coders. This is a free for all forum, no question is too stupid and to noob.
Post Reply
User avatar
Epiales
Posts: 1119
Joined: Thu Aug 15, 2013 1:38 am

Mysql Row Counts [Resolved]

Post by Epiales »

Okay, I thought I could do a limit 1 to get the first row in the table. It works fine. And then I use a limit 1,2 to get the second row; it works just fine. But when I want to call the third row "limit 2,3" it doesn't work. Is there a reason?

1st Row Works Fine

Code: Select all

 $order = "SELECT * FROM locations LIMIT 1";
      $result = mysql_query($order);
      while ($row=mysql_fetch_array($result)){
        echo $row['id'];
        echo $row['location'];
        echo $row['name'];
2nd Row Works Find

Code: Select all

 $order = "SELECT * FROM locations LIMIT 1,2";
      $result = mysql_query($order);
      while ($row=mysql_fetch_array($result)){
        echo $row['id'];
        echo $row['location'];
        echo $row['name'];
3rd Row Displays Information But Will Not Update With New Information

Code: Select all

 $order = "SELECT * FROM locations LIMIT 2,3";
      $result = mysql_query($order);
      while ($row=mysql_fetch_array($result)){
        echo $row['id'];
        echo $row['location'];
        echo $row['name'];
Last edited by Epiales on Fri Aug 30, 2013 9:29 pm, edited 1 time in total.
Nothing fancy, but a work in progress!

http://gameplaytoday.net
User avatar
Epiales
Posts: 1119
Joined: Thu Aug 15, 2013 1:38 am

Re: Mysql Row Counts

Post by Epiales »

I have also tried:

Code: Select all

 $order = "SELECT * FROM locations WHERE id=3 LIMIT 1";
      $result = mysql_query($order);
      while ($row=mysql_fetch_array($result)){
        echo $row['id'];
        echo $row['location'];
        echo $row['name']; 
Whatever the reason, it will display the information, but it cannot be updated. It's the same identical coding for the other two, except where I limit it to the certain row number. The first and second rows work perfect. Can edit them fine, but the 3rd row just won't update. Is there any reason why it wouldn't? I created the first one and it worked, so I just duplicated the exact page, but changed the limit 1 to the limit 1,2. Did not change anything, and it worked fine. So I duplicated the page again and change the limit 1,2 to the limit 2,3 and it won't edit. GRRRR! Same code and all. Then I tried the above. It shows the 3rd row, but won't edit.
Nothing fancy, but a work in progress!

http://gameplaytoday.net
User avatar
Epiales
Posts: 1119
Joined: Thu Aug 15, 2013 1:38 am

Re: Mysql Row Counts

Post by Epiales »

OMG how FRUSTRATING LOL...

I can use the same form I have for the 3rd row and change the row number and edit the other two. But it won't work on 3?

if I change $order = "SELECT * FROM locations WHERE id=3 LIMIT 1";

To WHERE id=2, then I can go in and edit the 2nd row.

if I change $order = "SELECT * FROM locations WHERE id=3 LIMIT 1";

To WHERE id =1, then it will let me go in and edit the 1st row.

But if I leave it at: $order = "SELECT * FROM locations WHERE id=3 LIMIT 1";

It wont' let me edit it at all.

:cry: :cry: :cry: :cry: :cry: :cry:
Nothing fancy, but a work in progress!

http://gameplaytoday.net
User avatar
Epiales
Posts: 1119
Joined: Thu Aug 15, 2013 1:38 am

Re: Mysql Row Counts

Post by Epiales »

Well, whatever the case, I removed my table and re-added locations. All works fine. GRRR!
Nothing fancy, but a work in progress!

http://gameplaytoday.net
Post Reply

Return to “Beginner Help and Support”