0

I try to create dropdown list with informations from title column in sql table, but never succeeds.

My connection and query is good. Can somebody to help me with this?

mysql_connect();
mysql_select_db(
);
$query = mysql_query("SELECT title FROM test");

Thanks!

2
Contributors
1
Reply
3
Views
5 Years
Discussion Span
Last Post by bobgodwin
1

Try This:

echo '
<select name="title" id="title">
';
$query = mysql_query("SELECT title FROM test");
while($row = mysql_fetch_array( $result )) {
$opt = $row['title'];
echo '  <option value="'.$opt.'">' .$opt. '</option>
';
}
  echo '</select>

I've been using PDO for a while, so I hope this is right.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.