• 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

Warning: A non-numeric value encountered

PDOException SQLSTATE[HY000] [2002] No such file or directory

Coinpayments create_transaction "ERROR: Invalid command!"

How to use functions that are declared in snippets in Evolution CMS (Modx) in an external PHP Script?

Unsure why I am getting: Number of variables doesn't match number of parameters in prepared statement

How to get values inside <![CDATA[values]] > using php DOM?

Parsing JSON File to array in PHP

How do I get friend list from Friends table with counts of friends of my friends

correct PHP headers for pdf file download

Add custom text under order details on WooCommerce My account view order pages

Assign output of PHP function to a variable

Detect if PHP session exists

What is the function of the (new Date()).getTime() in PHP?

Connecting an HTML webpage to a SQL Server

Transform array, set each array element with parent key php

About Contact Privacy policy Terms and conditions