• 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

WooCommerce Additional Information - if empty, hide

Laravel whole batch is cancelled if one Job fails

I can't delete my image when it is liked because of the foreign key in mysql

How do I do HTTP basic authentication using Guzzle?

Wordpress 'post_type_link' hides permalink

Required field only if another field has a value, must be empty otherwise

how to prevent float variables displaying as scientific notation when printing [duplicate]

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

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

How do I remove this delivery notification from here?

If you intend you use SMTP, add your SMTP Code after this Line

How to get the total hour from starting time to end time in php

How to get quarter for future date using Carbon?

Sagepay Error The Vendor failed to provide a RedirectionURL

Accessors (Getter) & Mutators (Setter) On a Pivot Table in Laravel

About Contact Privacy policy Terms and conditions