You are here: Re: Select/Join query help (dropdown box?) « PHP Programming Language « IT news, forums, messages
Re: Select/Join query help (dropdown box?)

Posted by Geoff Berrow on 07/08/05 21:58

I noticed that Message-ID:
<1120846329.363902.109070@o13g2000cwo.googlegroups.com> from
guitarromantic@gmail.com contained the following:

>This might make a little more sense:
>http://www.scenepointblank.com/matt/dev/reviews/reviewedit.php?id=26

Working perfectly. It's fetching the first two columns Band_Name,
Record_Name and putting them in the select box
>
>This is the page I'm working with. I made some (bad) changes to the
>code so currently the dropdown box is displaying the wrong value
>(ordinarily it should be displaying a staff list) but basically, the
>code you quoted is just for the dropdown. The other parts of the form
>are supposed to be filled by the other 7 columns.

Whoa. If only one row is returned from this query, why do you need a
select box?

>Also, I'm quite new to php/sql.. could you elaborate on what print_r
>does?

It prints the contents of the array. It will show you what you've got.
Right now it looks like your Staff_Name will be contained in $row2[3]
and Staff_id in $row2[4]

So you could lose the list and do:

echo "<option value=\"".$row2[4]."\">".$row2[3]."</option>";

However, if you want all the reviewers in a drop down box, you'll have
to query the staff table separately and create an array from which you
can generate the drop down box. Each time round the loop check if the
value matches the value returned from the first query. If it is, print
selected in the option tag.

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация