RE: [PHP-DB] Re: Select

2005-05-18 Thread David Robley
Miguel Guirao wrote:

 You are right David, I have an auto_increment field!!
 
 What about this:
 $items2 = mysql_query(SELECT DISTINCT rev FROM rev ORDER BY rev, $link);
 
 where rev is a revision field for parts in my wharehouse!!!
 Does it will work in this case?
 
 Thanks
 
 -Original Message-
 From: David Robley [mailto:[EMAIL PROTECTED]
 Sent: Martes, 17 de Mayo de 2005 03:42 p.m.
 To: php-db@lists.php.net
 Subject: [PHP-DB] Re: Select
 
 
 Miguel Antonio Guirao Aguilar wrote:
 
 Hi!!
 
 I have this query in PHP:
 
 $items2 = mysql_query(SELECT DISTINCT * FROM rev ORDER BY rev, $link);
 
 I have three rows with the same data on it, and DISTINCT seems to be not
 working, since I got all the rows, any ideas of what is going wrong?
 
 Without knowing how many fields you have and what they are, no. But you
 should realise that DISTINCT looks at _all_ selected fields in a record,
 so if you have an auto_increment id field in amongst those selected, all
 the records will be different.
 
 David
 

That should work as you expect it to.

David

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



RE: [PHP-DB] Multiselect List

2005-05-18 Thread Ryan Jameson \(USA\)
That's not the problem. The problem is referring to the listbox via
javascript. It doesn't like the format: formName.listBoxName[].value it
has no problem with formName.listBoxName.value but then PHP doesn't seem
to handle it correctly.
 
 Ryan



From: Dimiter Ivanoff [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 18, 2005 12:25 PM
To: Ryan Jameson (USA)
Subject: Re: [PHP-DB] Multiselect List


Place the countries in array.
Name the select with your array name.
 
select name=?=$yourarrayname? 
 
and for the option use as value the keys from the array.Where your
keys may be the IDs of the countires from the db.

Ryan Jameson (USA) [EMAIL PROTECTED] wrote:

Hey Guys,

I'm populating a multiselect list with countries from my
database. PHP
seems to require the name contain array brackets, ie. myName[].
The
problem I'm having is referring to the select list via
javascript when
the name contains the brackets. Anyone know how?

Thanks.
 Ryan

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





How much free photo storage do you get? Store your holiday snaps for
FREE with Yahoo! Photos. Get Yahoo! Photos
http://us.rd.yahoo.com/mail/uk/taglines/default/photos/*http://uk.photo
s.yahoo.com/ 


Re: [PHP-DB] Multiselect List

2005-05-18 Thread Dusty Bin
Ryan,
you should be able to refer to the listbox in javascript as
document.formName.elements['listBoxName[]'].
Hope this helps...   Dusty
Ryan Jameson wrote:
 That's not the problem. The problem is referring to the listbox via
 javascript. It doesn't like the format: formName.listBoxName[].value it
 has no problem with formName.listBoxName.value but then PHP doesn't seem
 to handle it correctly.
snip

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



Re: [PHP-DB] Multiselect List. .

2005-05-18 Thread Patel, Aman
Ryan Jameson (USA) wrote:
That's not the problem. The problem is referring to the listbox via
javascript. It doesn't like the format: formName.listBoxName[].value it
has no problem with formName.listBoxName.value but then PHP doesn't seem
to handle it correctly.
 
There is a function called MM_findObj which does exactly what you 
need. I believe it originated from the Macromedia company (hence the MM 
prefix) - possibly used by Dreamweaver for its scripting purposes, but I 
digress.

Below is the funtion, and whenever you want to refer to oddly named form 
elements, you call MM_findObj('oddlyNamedFormElement[]') (and it returns 
an object reference to the form element that you can use normally).

function MM_findObj(n, d)
{
//v4.01
var p, i, x;

if (!d) {
d = document;
}

if ((p = n.indexOf('?'))  0  parent.frames.length) {
d = parent.frames[n.substring(p+1)].document;
n = n.substring(0,p);
}

if (!(x = d[n])  d.all) {
x = d.all[n];
}

for (i = 0; !x  i  d.forms.length; i++) {
x = d.forms[i][n];
}

for (i = 0; !x  d.layers  i  d.layers.length; i++) {
x = MM_findObj(n, d.layers[i].document);
}

if(!x  d.getElementById) {
x=d.getElementById(n);
}

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


Re: [PHP-DB] Multiselect List

2005-05-18 Thread Brent Baisley
It's not a problem. Just refer to it using elements[]
document.form_name.elements[fieldname[Value]]
On May 18, 2005, at 2:59 PM, Ryan Jameson ((USA)) wrote:
That's not the problem. The problem is referring to the listbox via
javascript. It doesn't like the format: formName.listBoxName[].value it
has no problem with formName.listBoxName.value but then PHP doesn't  
seem
to handle it correctly.

 Ryan

From: Dimiter Ivanoff [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 18, 2005 12:25 PM
To: Ryan Jameson (USA)
Subject: Re: [PHP-DB] Multiselect List
Place the countries in array.
Name the select with your array name.
select name=?=$yourarrayname? 
and for the option use as value the keys from the array.Where your
keys may be the IDs of the countires from the db.
Ryan Jameson (USA) [EMAIL PROTECTED] wrote:
Hey Guys,

I'm populating a multiselect list with countries from my
database. PHP
seems to require the name contain array brackets, ie. myName[].
The
problem I'm having is referring to the select list via
javascript when
the name contains the brackets. Anyone know how?

Thanks.
 Ryan

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



How much free photo storage do you get? Store your holiday snaps for
FREE with Yahoo! Photos. Get Yahoo! Photos
http://us.rd.yahoo.com/mail/uk/taglines/default/photos/*http:// 
uk.photo
s.yahoo.com/

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] Multiselect List

2005-05-18 Thread Dimiter Ivanoff
Well i did not see why the name have to be with
brackets [], can you show some code ?
If you create the select in the way that i said, the
name of the select will not have brackets , and the
javascript have to work.

--- Ryan Jameson (USA) [EMAIL PROTECTED] wrote:
 That's not the problem. The problem is referring to
 the listbox via
 javascript. It doesn't like the format:
 formName.listBoxName[].value it
 has no problem with formName.listBoxName.value but
 then PHP doesn't seem
 to handle it correctly.
  
  Ryan
 
 
 
 From: Dimiter Ivanoff [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, May 18, 2005 12:25 PM
 To: Ryan Jameson (USA)
 Subject: Re: [PHP-DB] Multiselect List
 
 
 Place the countries in array.
 Name the select with your array name.
  
 select name=?=$yourarrayname? 
  
 and for the option use as value the keys from the
 array.Where your
 keys may be the IDs of the countires from the db.
 
 Ryan Jameson (USA) [EMAIL PROTECTED] wrote:
 
   Hey Guys,
   
   I'm populating a multiselect list with countries
 from my
 database. PHP
   seems to require the name contain array brackets,
 ie. myName[].
 The
   problem I'm having is referring to the select list
 via
 javascript when
   the name contains the brackets. Anyone know how?
   
   Thanks.
Ryan
   
   --
   PHP Database Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
   
   
 
 
 
 How much free photo storage do you get? Store your
 holiday snaps for
 FREE with Yahoo! Photos. Get Yahoo! Photos

http://us.rd.yahoo.com/mail/uk/taglines/default/photos/*http://uk.photo
 s.yahoo.com/ 
 





___ 
Yahoo! Messenger - want a free and easy way to contact your friends online? 
http://uk.messenger.yahoo.com

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



Re: [PHP-DB] Multiselect List. .

2005-05-18 Thread Martin Norland
Patel, Aman wrote:
Ryan Jameson (USA) wrote:
That's not the problem. The problem is referring to the listbox via
javascript. It doesn't like the format: formName.listBoxName[].value it
has no problem with formName.listBoxName.value but then PHP doesn't seem
to handle it correctly.
There is a function called MM_findObj which does exactly what you 
need. I believe it originated from the Macromedia company (hence the MM 
prefix) - possibly used by Dreamweaver for its scripting purposes, but I 
digress.

Below is the funtion, and whenever you want to refer to oddly named form 
elements, you call MM_findObj('oddlyNamedFormElement[]') (and it returns 
an object reference to the form element that you can use normally).
[snip]
An addendum to that, two points:
 (mixed js and html examples, patently obvious which is which though)
1) You can use this for more than just form elements, if you give an 
item an id.  e.g.
	div id=my_great_divhello world/div
	h8_ie_my_great_div = MM_findObj(my_great_div);

2) This is just a general warning, but I used to stumble into it a lot. 
 IE creates variables/objects in the document namespace, essentially 
polluting it - good for convenience, bad for cross-browser anything.  As 
an example:
	input name=nothing
can be used as just nothing e.g.:
	alert(nothing);
... and in fact, you get errors when you try to do things like:
	nothing = MM_findObj(nothing);
because IE doesn't like to overwrite its pretty little objects.  Which 
nobody asked for.  The only solution is to use different names for the 
javascript variables describing/referring to your form/other elements.
	h8_ie_nothing = MM_findObj(nothing);

cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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