Hi all,
I'm very new so be kind 🙂
I have a database which I need to get the value from the last index field from to increment and use as the index for the record being entered.
It was all working fine until I deleted a couple of records so while mysql_num_rows reports the correct number of rows, what I need is the value to avoid a duplicate entry.
the following code doesn't work but it is as far as I have got. I have searched endlessly and bashed my head against it for ages.
//$result is from a previous query which also displays the contents of the db
$rowsInDb = mysql_num_rows($result);
echo 'number of rows in DB= ' . $rowsInDb . '<br><br>';// just there for debugging
$lastRow = mysql_query("SELECT `Index` FROM `myDatabase` WHERE 1 LIMIT".$rowsInDb." , 1");
echo 'last row in DB= ' . $lastRow . '<br><br>';// just there for debugging
$num_rows = $lastRow +1;
//$num_rows is then used for the record being added to the database[/SIZE]
The last echo doesn't print a value.
I know I am missing something important here, so any help would be much appreciated.
Ta
Jangle