• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Dropdown with current value from Mysql

phphtmlmysqldropdown


PHP Snippet 1:

<select name="vendors" id="vendors"  required>
                    
<?php
    include "dbConn.php";  
    $records = mysqli_query($db, "SELECT vendors FROM tools WHERE id=$id UNION SELECT vendoren FROM vendors");  

    while($data = mysqli_fetch_array($records))
    {
        echo "<option value='". $data['vendors'] ."'>" .$data['vendors'] ."</option>";  
    }   
?>  </select>

Related Snippets

MySQL - Connection failed: No route to host

Why rand() every time I refresh the page?

How to convert the int value to inch in PHP [closed]

How to properly set "0000-00-00 00:00:00" as a DateTime in PHP

Store multiple fields in JSON column (Nova CMS)

Clients authentication and user authentication with laravel

Why i get wrong output for html markdown?

Creating a config file in PHP

Artisan, creating tables in database

How to show a popup modal in codeIgniter?

How do I call a php file with axios?

Laravel 5 session not persisting after user is logged in

dompdf and img tag, image wont show

Using Associative arrays

Add Class in html Dynamically in PHP

About Contact Privacy policy Terms and conditions