• 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

Add Class in html Dynamically in PHP

Chunk and transpose a flat array into rows with a specific number of columns

Generate random username based on full name php

Valet, Xdebug after reboot Big Sur not working

Google Calendar API batch request PHP

How to use a PHP MVC Controller, one thats invoked by calling a URL, to call and execute more than one function? [duplicate]

How to find phpcs current default standard

I can't delete my image when it is liked because of the foreign key in mysql

Creating Combinations of Elements

loop through an anchor id

PHP code for generating decent-looking coupon codes (mix of letters and numbers)

Yii2 select2 database exception number of bound variables does not match number of tokens

PHP: Print caught exception like Xdebug

PHP7 CLI attempts to load xdebug twice - "Cannot load Xdebug - it was already loaded"

wordpress : How to specify the cause "This site can’t be reached"

About Contact Privacy policy Terms and conditions