Re: Inserting data without a reference in the row.
| From: | heilo | Date: | Sun, 20 Apr 2003 23:30:53 +0000 |
| Subject: | Re: Inserting data without a reference in the row. | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-27203@lists.php.net to get a copy of this message | ||
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??...