non-auto increment question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I want to insert a new table entry 1 number higher than the highest in
the field (id). I cannot use auto-increment.
And I want to show the value of the field to be added in an input field
on the web page:
if (isset($_REQUEST["AddNewBooksRequest"])) {
    $SQL = "SELECT MAX(id) FROM book";
        $result = mysql_query($sql, $db);
        $bookCount = mysql_num_rows($result);
            for ($i=0; $i < $bookCount; $i++) {
            $row = mysql_fetch_array($result);
            $idIN    = $row["id"]+1;
            }
    $idIN            = $_POST["idIN"];
    $titleIN        = $_POST["titleIN"];

...snip...

<td colspan="2">
<?
echo "<input type='text' name='titleIN' value='$idIN' disabled size='2'>";
?>
</td>

What am I doing wrong? (The query works and returns the right nr. but
what do I have to do to add 1 to that number and then display it in the
on page and post it to the table?

-- 

Phil Jourdan --- pj@xxxxxxxxxxxxx
   http://www.ptahhotep.com
   http://www.chiccantine.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux