I'm populating a dropdown from a mysql table with php but some cells in the column are blank, so in the dropdown there are gaps where these blanks are. Can i choose not to show blank cells or something?

Thanks

Yes, adjust your query to exclude them.

SELECT * FROM yourtable WHERE TRIM(yourcolumn) <> ''

$fields is the user submitted value from the first dropdown asking to select a field name.

The query below doesnt work just wanted to double check this was right?

Thanks

$result1 = mysql_query("select distinct * from `parts` WHERE TRIM(".$fields.") <> '' order by ".$fields."") or die(mysql_error());

If $fields is just one string column, I see no reason why it shouldn't work. Do you get an error, if so, which one ?

I dont get an error, but it still fills the dropdown with blank results!?

Perhaps you better remove the blanks in php then.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.