• 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

Laravel websockets AWS EC2 - Connection failed

run a query using EXECUTE BLOCK to prepair a column for an unique-Index

Laravel PackageManifest.php: Undefined index: name

Yii2: How to download backup files using spanjeta/yii2-backup?

PHP only Hit Counter?

Warning: sqlite_query() expects parameter 1 to be resource, string given

In PHP, which is faster: preg_split or explode?

SQL AVG() to 2 decimals

WHM Enabling mod_rewrite

How to show a popup modal in codeIgniter?

auth pages not getting css in laravel

How to execute sql code based on fetch array

Insert multidimensional array to codeigniter cart

Select option from dropdown menu with PHP and mySql

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

About Contact Privacy policy Terms and conditions