• 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

Install mysql client in docker image

Upload a file Using PHP and JavaScript

passwordless LDAP login and get user information using Kerberos ticket in PHP

Display a product custom field only in WooCommerce Admin single orders

Sentry + Laravel: how to log an already catched Exception?

WooCommerce: Add/display Product or Variation custom field everywhere

MISSING UPDATES FOR: MEDIA Drupal 9

How to implement placeholder in a php file for moodle plugin?

Add bold text and line break into Laravel Notification Email

How to create a cookie to store the timestamp of when a page is first loaded with php

PHP: Convert any string to UTF-8 without knowing the original character set, or at least try

Change the alert text on add to cart action without selected variation in Woocommerce

Why "Class 'GuzzleHttpClient' not found" even after Installing it in Laravel?

cakephp save drag and drop list order to database

SMTP "Error: DATA not accepted from server!" Opencart 2.3 on InMotionHosting

About Contact Privacy policy Terms and conditions