• 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

Symfony - EasyAdmin - Add and remove functions are ignored from AssociationField

How to get result of the formula on import xlsx with maatwebsite using Laravel? I get formula and not value of the formula

Query Optimization, changing the queries in the loop into a single processing query

PHP how to detect if running on arm64 cpu?

mysql_result is defined but mysql_free_result warns it expected a resource

Convert regular text to array using notepad++

Store / Website Column in Magento 2 Admin Grid - Custom Module

Split comma separated value from table column into rows using mysql?

Laravel 5.1 xmlHttpRequest AJAX POST TokenMismatchException

Group rows by column and sum another column within groups [duplicate]

Get all WooCommerce products within own plugin

Submitting a form with ajax in Wordpress

The "client_reference_id" argument is not passed

WAMP Virtual Host not working

Adding the custom page with add_menu_page function on Wordpress

About Contact Privacy policy Terms and conditions