Help Please Select Max Not Working

This is a discussion on "Help Please Select Max Not Working" within the PHP Forum section. This forum, and the thread "Help Please Select Max Not Working are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old May 12th, 2007, 20:00
New Member
Join Date: Apr 2007
Location: London
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Help Please Select Max Not Working

Hi,

Can someone please tell me what is wrong with this code, it is doing my nut!!!!!


$result=mysql_query("SELECT max(productcode) FROM tblproductcodes where categoryID=$category");
$lastproductcode=mysql_fetch_row($result);
echo $lastproductcode[productcode];

I have checked that something is returned, one row is returned, yet I cannot for the life of me get the resulting figure out, it's just blank. What am I doing wrong? Please help .

It's sad enough that I'm spending my Saturday evening working, but even worse that what I'm doing is not even working.

Thank you in advance
Reply With Quote

  #2 (permalink)  
Old May 13th, 2007, 06:18
Reputable Member
Join Date: Jul 2005
Location: Melksham, Wilts, UK
Posts: 293
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help Please Select Max Not Working

Try
echo $lastproductcode[0];
Reply With Quote
  #3 (permalink)  
Old May 13th, 2007, 09:30
Reputable Member
Join Date: May 2006
Location: Northampton, UK
Posts: 399
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help Please Select Max Not Working

how is php work?... the two are completely different.

If grahame's solution doesnt work you may try adding the '' and do:

Code: Select all
echo $lastproductcode['productcode'];
Dont you need those when dealing with arrays?
Reply With Quote
  #4 (permalink)  
Old May 13th, 2007, 19:11
New Member
Join Date: Apr 2007
Location: London
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help Please Select Max Not Working

Hi Grahame,

Thanks that worked a treat. Your a star xxx

Thank you so much

Reply With Quote
Reply

Tags
phpselect max

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
chained select box dependable select thenamenoonehastaken JavaScript Forum 0 Feb 8th, 2008 05:49
Clone Select - Rename not working in IE Awok JavaScript Forum 1 Jan 9th, 2008 17:22
styling a select box, using php, ..not working...need help sambkk Web Page Design 0 Feb 5th, 2007 19:22
CSS and select djme Web Page Design 1 Mar 2nd, 2006 02:05
Select a row and go! Please help? taymond JavaScript Forum 1 Nov 16th, 2005 15:50


All times are GMT. The time now is 01:58.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43