Re: Inserting data without a reference in the row.

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

 



Hi!


Sorry, first i got you wrong -  reading is quite complicated - i know :)

So here is my suggestion:

$primkey = 325;

$qry = 'SELECT `number` FROM `movies` ORDER BY `number` DESC LIMIT 0, 1';
$max_number = mysql_fetch_array(mysql_query($qry));
$max_number = $max_number['number'];

$qry = 'INSERT INTO `table` (`col1`, `col2`, `col3`, `col4`, `number`)
VALUES ("val1", "val2", "val3", "val4", '.($max_number+1).')';

$res = mysql_query($qry);

So. this should work i thing :)

.ma

Raymond Lilleødegård <rhov@c2i.net> wrote@21.04.2003 1:11 Uhr:

> Hi!
> 
> I'm trying to add a new column in my moviedatabase because I want to have a
> movienumber that doesn't have "holes" between the movies when I delete a
> movie. So I have to update the new column with increasing numbers. Is it
> possible to refer to row with a mysqlnumer of any kind?
> 
> Best regards Richard
> 
> 

Matthias Steinböck
Email: grillen@abendstille.at
Web: http://www.abendstille.at

Frühabendliches Webdesign.
------------------------------------------
Im Übrigen sind wir der Meinung, dass
Die Welt so vor ihrem Untergang
Gerettet weden könnte: Also, man muss -
Verdammt, wo ist mein Butterbrot??...


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



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux