Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host="xxxxxxxx";
- $dbName="xxxx";
- $dbUser="xxxxxxxxxx";
- $dbPass="xxxxxxx";
- $dbh = new PDO( "sqlsrv:server=".$host."; Database=".$dbName, $dbUser, $dbPass);
- $dbh->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
- $sql = "SELECT DISTINCT [Major Category] FROM Products";
- $dropdown = $dbh->query($sql);
- ?>
- <table cellspacing="5" id="dropdown-table">
- <thead>
- <tr>
- <th>Major Category</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>
- <select>
- <?php
- foreach ($dropdown->fetchAll($sql) as $drop) {
- ?>
- <option value="major"><?php echo $drop ['Major Category'];?></option>
- <?php
- }
- ?>
- </select>
- </td>
- </tr>
- </tbody>
- <table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement