?
Solved

Php - Move to the last record in the database

Posted on 2000-03-12
3
Medium Priority
?
212 Views
Last Modified: 2015-08-19
How do i directly move on to the last record using Php and mysql
0
Comment
Question by:karanp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Accepted Solution

by:
jayy earned 200 total points
ID: 2609307
Hi karanp,

Here's some code that I think might solve.

$result = mysql_query($query);

// Get the number of result returned
$i = mysql_num_rows($result) - 1;

// This should seek to the last record in your database

mysql_data_seek($result, $i);

$row = mysql_fetch_row($result);

Good luck


0
 
LVL 8

Expert Comment

by:F P
ID: 40937189
"ORDER BY id DESC" in your query won't work?
0
 
LVL 8

Expert Comment

by:F P
ID: 40937190
... or "SELECT MAX(id) FROM database;" format of your SQL?
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question