• 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

CodeIgniter 4: Like and Dislike Functionality

ORA-12546: TNS:permission denied error connection to remote oracle server

Symfony Mercure "Failed to send an update"

Transform array, set each array element with parent key php

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

XML to CSV with PHP converter [problem with images grabing]

Laravel : How to Create Dropdown to Select FOREIGN KEY from Other Table?

How do I set the maximum php memory limit

Using array_intersect on a multi-dimensional array

How to get unique slug to same post-title for other time too?

Laravel update hasMany relationship using saveMany

PHP echo values of all sub keys [duplicate]

Symfony 4: how to allow dynamic values for array nodes in bundle configuration?

Undefined variable in Laravel 8 project (php 7.4)

Laravel: HTML in notification

About Contact Privacy policy Terms and conditions