Solved

Php - Move to the last record in the database

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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

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