We help IT Professionals succeed at work.
Get Started

MySQL rows showing problem

ftpphptest1
ftpphptest1 asked
on
252 Views
Last Modified: 2013-12-13
$result2 = mysql_query("select * from  machine2 order by ID desc limit 2");
i can use this to get the last 2 data of ID in my table machine1

but if i change the table machine1 , delete the  ID INT NOT NULL auto_increment, then i cant use this to locate the last 2 rows of data~~~
but i still want to show the last 2 rows in php

how can i do it ?
CREATE TABLE machine1 (
 ID INT NOT NULL auto_increment,
 Date varchar(20),
 Time varchar(20) NOT NULL default '',
 GapTime varchar(100) NOT NULL default '',
 MachineNumber varchar(20) NOT NULL default '',
 PRIMARY KEY (ID)
)type=myisam auto_increment=1;

Open in new window

Comment
Watch Question
CERTIFIED EXPERT
Distinguished Expert 2020
Commented:
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE