?
Solved

Php - Move to the last record in the database

Posted on 2000-03-12
3
Medium Priority
?
219 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
  • 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses
Course of the Month16 days, 9 hours left to enroll

864 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