Jump to content

got problem on mysql


wxpsadd

Recommended Posts

actually,

 

in ASP its very easy to use movelast, the code below points on the last record in the database:

 

 

set r = server.createobject("adodb.recordset")

sql = "select * from tblsomething"

r.open sql,c,1,3

r.movelast 

 

i can open, connect , databases and tables in mysql but i just dont know how to make movelast in php mysql

 

any ideas how to do this?

 

thanks in advance

 

 

Link to comment
Share on other sites

geez would it kill you to try and answer the guys question?

 

u assume you mean the MoveLast equivalent to the VB/.nET stuff (which afaik selects the last row in a database)

 

in which case:

SELECT col1, col2, col x FROM tablez ORDER BY abc DESC LIMIT 1 

 

this would return exactly 1 row; the last one.

 

if this isn't what you're looking for then yeah please try to be clearer!

 

Alex

Link to comment
Share on other sites

Actually, php's equivelent would be....

 

<?php

  $sql = "select * from tblsomething";
  if ($result = mysql_query($sql)) {
    if ($row_count = mysql_num_rows($result)) {
      mysql_data_seek($result, $row_count-1);
    }
  }

?>

 

The $result resource should now be sitting at the last pointer position.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.