• 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 do I loop through an MS SQL database with VB.NET?

php file upload scanning using clamav, permissions on /tmp/

CodeIgniter force_download is not working

Exact alternate to mcrypt_encrypt in PHP 7.2

Warning file_get_contents () failed to open stream: HTTP request failed! HTTP/1.0 402 Payment Required

Android Volley getParams() method not getting called for JsonObjectRequest

phpunit - mockbuilder - set mock object internal property

Edit XML in HTML form and submit to self

wp_remote_get() not passing authentication

How Can I Do LIMIT 1, 2 In WP_Query

How can I pass the list to the component variable in Laravel?

Laravel 5: Is there a non-case sensitive way to sort a collection by an attribute?

Insert And Retrieve Data in MySQL with $.post Noob Question

How to get Laravel's CSRF Token from Another Website?

Clients authentication and user authentication with laravel

About Contact Privacy policy Terms and conditions