If my database has 1 row, everything is flawless. If it has more than 1 row, I get errors.
Basically, I want to open my database, select the LAST entered row (highest "id"), and use that id ...
What I have:
---------------------------------------
$query = "SELECT * FROM my_register ORDER BY id DESC";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
while ($row = mysql_fetch_assoc($result)) {
$lastid = mysql_result($result,"id");
}
mysql_free_result($result);
---------------------------------------
What am I doing wrong?
Basically, I want to open my database, select the LAST entered row (highest "id"), and use that id ...
What I have:
---------------------------------------
$query = "SELECT * FROM my_register ORDER BY id DESC";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
while ($row = mysql_fetch_assoc($result)) {
$lastid = mysql_result($result,"id");
}
mysql_free_result($result);
---------------------------------------
What am I doing wrong?