getting last entry in database table
| From: | Martin Skjöldebrand | Date: | Sat, 17 Mar 2001 16:24:13 +0000 |
| Subject: | getting last entry in database table | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-7563@lists.php.net to get a copy of this message | ||
I have a table containing steps toward solving a problem. I want to pass
the last entry to another database as a solution.
How do I do this? What I've tried today is:
<? if (isset($cmdAddtoKb)) { // If I want to move the solution do ...
$querykb ="SELECT e_description FROM events WHERE t_id = '$t_id';";
$resultkb = mysql_query($querykb, $mysql_link);
$answer = mysql_fetch_row($resultkb);
$teststring = current($answer); // set up a teststring if empty we are
//outside array. First entry is
//never empty
while ($teststring != "") { //while we are inside the array
$kb_answer = $teststring; //pass the current string to the final
//variable
next($answer); //go to next string in array
$teststring = current($answer); //give testvariable new string
}
What happens is that the while-loop never seems to loop at all.
I don't get any errors but it simply doesn't assign entry number 2 to
$teststring. It's stuck at entry number 1 (setup outside the loop).
I'm missing something obvious again. What?
TIA
Martin S.