• 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

How to get the ID of the link in another page in php

Combine multiple columns into an array as one of the key in a results set

I need to link Google Sheet with my Laravel

Inserting Country Selection into MySQL PHP [duplicate]

PHP: How to raise number to (tiny) fractional exponent?

How can I get a div content in php

Symfony - EasyAdmin - Add and remove functions are ignored from AssociationField

Query Optimization, changing the queries in the loop into a single processing query

Store multiple fields in JSON column (Nova CMS)

Sum column values from multiple arrays

"There is no active transaction" when refreshing database in Laravel 8.0 test

Prevent blank space in pdf pages (DomPdf)

Load a .env file with PHP

I want a way to give path to my files which are outside of public folder in laravel

How to convert time from one timezone to another in PHP

About Contact Privacy policy Terms and conditions