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
page_id (gives the type of page - one of the main six links)
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
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
Tel: #353 (0)46 77663
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>