• 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 array, move keys and values to new array, but mix it up

Warning: A non-numeric value encountered

best way to store error messages in Laravel (session or variable)

How to render html from a @foreach loop in a textarea

XDebug not working in VScode for php debugging

Why rand() every time I refresh the page?

Laravel Blade checkbox not checked

retrieve data from database using session

json_encode turns array into an object

Sum column values from multiple arrays

loop through an anchor id

How can I make a full text index of the column?

Prevent blank space in pdf pages (DomPdf)

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

Post Form Data To phpmyadmin Database

About Contact Privacy policy Terms and conditions