I am trying to return the last id and increment it to put in the value attribute. I can make it work with old mysql but not with the PDO. I am learning (I think) PDO but it is not making sense.
Below is the code.
<td><label for="invNum"></label>Invoice</td>
<?php
$stmt = $dbconn->prepare("SELECT max(invId) FROM invoices");
$stmt->execute();
$invNum = $stmt->fetch();
/* mysql_select_db("customers", $dbconn);
$result = mysql_query("SELECT max(invId) FROM invoices");
if (!$result) {
die('Could not query:' . mysql_error());
}
$invNum = mysql_result($result, 0);*/
?>
<td><input type="text" name="invNum" id="invNum"
size="12" value="<?php echo ++$invNum; ?>" /></td>