• 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

401 Unauthorized only occurring on some pages in Laravel 8

Laravel: Why is my variable not being set while it's in the construct function of the controller?

backup files to google drive using PHP

phpunit - testing is painfully slow

How to map the two arrays with a duplicate value?

Uploading video to Youtube using Youtube Data API V3 and Google API Client PHP -- getting 401 (unauthorized) message

Adding custom body class to the custom archive pages

Form Validation and Submission to database

Is there a way to use the same parameter into multiple place in the same query with Eloquent? [duplicate]

How to get variable from JavaScript to PHP [duplicate]

XDebug not working in VScode for php debugging

Limit WooCommerce products in cart only from one custom taxonomy

Laravel whole batch is cancelled if one Job fails

Debugging Stripe Webhook Event

Component install error: JInstaller: :Install: File does not exist

About Contact Privacy policy Terms and conditions