However, without knowing more about the source of the data what will go into the select, I cannot advise you further. ______________________________________________________________________
TANSTAAFL!
Well, I am not sure but let me try to explain.
So I have a table (t1) with ~100 rows and in one of the column (c3)contains one of the following value (blank,type1,type2,type3...). So I would like the selection box to have the name of each item only once. What I have so far will populate all the items in the box.
[...]
// create SQL statement
$sql = "SELECT c3 FROM t1
ORDER BY c3 ASC";
// execute SQL query and get result
$sql_result = mysql_query($sql,$connection)
or die("Couldn't execute query."
// put data into drop-down list box
while ($row = mysql_fetch_array($sql_result)) {
$deviceid = $row["c3"];
$option_block .= "<OPTION value=\"$c3\">$c3</OPTION>";
}
sleipnir214,
Thank you. Yes, that is what I needed. You just have all the answer . And I was about to attempt to use 'in_array' function to walk through and check for repeating string when I have to idea if in_array is appropriate for the task and no very strong on coding.
As someone once posted, if you have a doubt/question, ask.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.