FW: [PHP-DB] SELECT MAX(ID) PLUS 1
| From: | Rubanowicz, Lisa | Date: | Wed, 28 Mar 2001 10:40:10 +0000 |
| Subject: | FW: [PHP-DB] SELECT MAX(ID) PLUS 1 | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-7934@lists.php.net to get a copy of this message | ||
Can anyone help me on this one
Lisa
-----Original Message-----
From: Walter [mailto:walter@waltersworld.nl]
Sent: Wednesday, March 28, 2001 10:55 AM
To: Rubanowicz, Lisa
Subject: Re: [PHP-DB] SELECT MAX(ID) PLUS 1
Are tables are to differnet, so you don't have anything on my code
Sorry
----- Original Message -----
From: Rubanowicz, Lisa <mailto:lisa.rubanowicz@cnh.com>
To: 'Walter' <mailto:walter@waltersworld.nl> ; Rubanowicz, Lisa
<mailto:lisa.rubanowicz@cnh.com>
Sent: Wednesday, March 28, 2001 10:57 AM
Subject: RE: [PHP-DB] SELECT MAX(ID) PLUS 1
HI Walter,
Could you please send me an excerpt of your code so I can see is my PHP
syntax incorrect.
Thanks Walter
Lisa
-----Original Message-----
From: Walter [ mailto:walter@waltersworld.nl <mailto:walter@waltersworld.nl>
]
Sent: Wednesday, March 28, 2001 10:09 AM
To: Rubanowicz, Lisa
Subject: Re: [PHP-DB] SELECT MAX(ID) PLUS 1
I think that your tables aren't good, my site have to menu's and submenu's
but i don't have that problem
----- Original Message -----
From: Rubanowicz, Lisa <mailto:lisa.rubanowicz@cnh.com>
To: 'Walter' <mailto:walter@waltersworld.nl>
Sent: Wednesday, March 28, 2001 10:40 AM
Subject: RE: [PHP-DB] SELECT MAX(ID) PLUS 1
I can't use auto_increment on two fields in the same table!!
pg_id is auto_increment
Lisa
-----Original Message-----
From: Walter [ mailto:walter@waltersworld.nl <mailto:walter@waltersworld.nl>
]
Sent: Wednesday, March 28, 2001 9:42 AM
To: Rubanowicz, Lisa
Subject: Re: [PHP-DB] SELECT MAX(ID) PLUS 1
Why don't you use the auto_increment fucntion in MySQL self?
----- Original Message -----
From: Rubanowicz, Lisa <lisa.rubanowicz@cnh.com>
To: <php-db@lists.php.net>
Sent: Wednesday, March 28, 2001 10:17 AM
Subject: [PHP-DB] SELECT MAX(ID) PLUS 1
> Hi All,
> I have been driven maaaaaad with this now for about a week and have looked
> all around for the answer but seem to get sent off in a tangent any time I
> get close. My SELECT statement seems to be right when I run it in
> MySQLFront but to add 1 in PHP ......????
>
> Here is the story. I have a small web site running from mySQL. Initially
I
> had it all in different tables then an ASP colleague said I should do it
it
> one table and use SELECT MAX(sub_id) etc.
> The site has obviously main navigation links Products, Freight Software,
> Small to Medium businesses and News etc. along the top of the site. But
for
> each of the first three I want "Sub Links" (Products 1, Products 2,
Products
> 3 etc) So I have a table like so
>
> pg_id (auto_increment)
> page_id (gives the type of page - one of the main six links)
> page_name
> sub_id (I need this to be 1, 2, 3 etc depending on how many pages they add
> to each section through a web form)
> sub_name (Clickable text for sub link)
>
> Of course there are many other fields (Title of page, Content of page, IMG
> for page etc)
> My problem is when I do a SELECT MAX(sub_id) AS sub_id_max WHERE page_id =
> $page_id I can't seem to get that figure in PHP and add 1 to it
> (increment). If I could do this, I would then do my INSERT INTO etc to
add
> a new Sub Page for that section.
> I obviously can get the page_id in 'cause I am passing it over from the
> previous page.
>
> Can I do this or do I need to separate it out. I have redesigned the
(very
> small) database 3 times now but the logic of it has me stumped. Ideally I
> would like to be able to keep it all in one table, but you guys know best.
>
> Could you please send me the four or five lines of code to do the above as
> it must be something with the SYNTAX
> Thanks in advance
> All the bEst
> Lisa
>
> Lisa Rubanowicz
> Case ITC,
> Navan, Ireland
> Tel: #353 (0)46 77663
>
> lisa.rubanowicz@cnh.com < mailto:lisa.rubanowicz@cnh.com
<mailto:lisa.rubanowicz@cnh.com> >
>
>
>