• 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

PHP/HTML: Creating A SubMenu

Laravel Sanctum CSRF not authenticating

Having issue with matching rows in the database using PDO

Google Gmail API - How to login programatically?

Check for PDO Results, If None Display Message, If Yes then Loop Through

CONCAT columns with Laravel 5 eloquent

PHP/HTML: Creating A SubMenu

virtctl works when executed via command line but not from php exec()

generate an Excel file using PHP

Warning: mysqli_stmt::bind_param(): Number of elements in type definition string doesn't match number of bind variables 11 [closed]

Search for array row with specific column value and return another value from qualifying row

Add customer email and phone in "Order" column to admin orders list on Woocommerce

Apply session id from request header

Exact alternate to mcrypt_encrypt in PHP 7.2

Fatal error: [] operator not supported for strings

About Contact Privacy policy Terms and conditions