• 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

CodeIgniter 4: Like and Dislike Functionality

Two buttons one form

Laravel 5 issue with wherePivot

User pool client {id}does not exist

WHM Enabling mod_rewrite

nginx err_connection_refused, can anyone help me?

Apply filter array/return terms

Get keys from associative array [duplicate]

Log a user out of a website when they put their computer to sleep

CodeIgniter 3 is generating a session file on each request, why?

Changing font color in javascript

PHP password_verify

Laravel with App Engine Standard Class 'FacadeIgnitionIgnitionServiceProvider' not found

PHP Find Array Index value in multi-line array

How do I upload a laravel project on cPanel shared hosting?

About Contact Privacy policy Terms and conditions