Page 1 of 1
Get Next Value
Posted: Wed Dec 28, 2005 9:52 pm
by blacksnday
If I wanted to select a value, then based on that value find the next
available value, how would that be done?
Code: Select all
$query = "select * from table where did='$value' ";
so I first get the value... now based on this I need to
get the next available within the same
while
Posted: Thu Dec 29, 2005 12:35 pm
by anjanesh
Give an example of what you are trying to achieve.
Posted: Thu Dec 29, 2005 2:37 pm
by blacksnday
anjanesh wrote:Give an example of what you are trying to achieve.
hmm, i thought i did ...
lets say i grab results with using
articleid as
how I identify it. When on the current
articleid
I need to display the next available
articleid.
If
articleid was an auto_increment then it would be easy
as I would just do something like
Code: Select all
$current_article = $row['articleid'];
$next_value = $current_article + 1;
but when it is not auto_inc, and i need to get
the correct id (not just +1) of the next available
I am lost with how to do it.
Posted: Thu Dec 29, 2005 2:43 pm
by anjanesh
Do a second
mysql_fetch_array(),
mysql_fetch_assoc() or
mysql_fetch_row() to get the next value and then
mysql_data_seek() to a specified location.
Posted: Thu Dec 29, 2005 2:46 pm
by blacksnday
thanks
