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
https://forums.phpfreaks.com/topic/130681-got-problem-on-mysql/#findComment-678187
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
https://forums.phpfreaks.com/topic/130681-got-problem-on-mysql/#findComment-678189
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
https://forums.phpfreaks.com/topic/130681-got-problem-on-mysql/#findComment-678878
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.