• 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

Display the WooCommerce product price inside a custom function

PHP contact form configuration [duplicate]

Cross-Origin Resource Sharing (CORS) witth Laravel and Vuejs

php curl_exec() Connection refused when retrieving a remote image

Correct way to use LIKE '%{$var}%' with prepared statements?

How to prevent phpmailer sending embedded image as an attachment on Gmail?

curl returning 301 error after migrating to https

WAMP Virtual Host not working

Unit (real unit test) of test laravel relationship

Merge key and value of array index [duplicate]

Querying only one row from a one to many relationship laravel

Display Link Title Instead of URL in XSL

Utf8 encoding issue with Laravel

Woocommerce Checkout - Add conditional field required if one field is filled

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

About Contact Privacy policy Terms and conditions