Hi all,
I'm running the following query:
PHP Code:
$sql3 = "SELECT page_id FROM $table"; $result3 = mysql_query($sql3) or die ("Couldn't perform query -".mysql_error()); $row = mysql_fetch_array($result3); $num = mysql_num_rows($result3); // Get the last number in the array of page_id's $last = $row[$num]; $new = $last+1;
... in order to generate a number for use later in the script. I was expecting "$row[$num]" to be the number stored in the last row of "page_id", but it's not: the only value I can get for $new is 1.
Please note that I am attempting to get the value contained in the last row of "page_id", not the row number itself!
What am I doing wrong?
Thanks in advance!
|