Solved

Php - Move to the last record in the database

Posted on 2000-03-12
3
203 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 100 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
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 count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now