I'm a designer and not developer, so I don't even know HOW to ask this question.

I have a select box in my script and it shows only one user type. But I need it to show more user types, for example, user_type 2, but Ive tried adding AND / OR and it doesnt work.

Heres the script code.

$result = mysql_query ('SELECT id,email,username FROM ' . $dbacct . '
WHERE user_type="3" ORDER BY username ASC', $link) or die(mysql_error());

Heres the full line

<select class=\'widtha\' name=\'contact_user\'>
                ';
                $result = mysql_query ('SELECT id,email,username FROM ' . $dbacct . ' WHERE user_type IN ("2","3") ORDER BY username ASC', $link) or die(mysql_error());

                while ($row = mysql_fetch_array ($result))
                {
                    $row = safe_data ($row, 'display');
                    echo '<option value=\'' . $row['email'] . '\'';
                    if ($row[id] == $_POST[contact_user])
                    {
                        echo ' selected=\'selected\'';
                    }

                    echo '> ' . $row['username'] . '</option>';
                }
                echo '</select>

Please can someone help me. Anton

有帮助吗?

解决方案

$result = mysql_query ('SELECT id,email,username FROM ' . $dbacct . '
WHERE user_type IN ("1","2","3",....) ORDER BY username ASC', $link) or die(mysql_error());
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top