• 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

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

Increase value by 1 on button click

In PHP, which is faster: preg_split or explode?

How do I truncate a decimal in PHP?

how to remove %20 in the url in php

Fatal error: Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, null given in

How to write PHP in XSLT

Unable to match results of php hash_hmac() and coldfusion hmac()

Error when uploading certain .png files "Interlace handling should be turned on when using png_read_image"

Encrypt in php and decrypt in Dart(flutter)

Is there a way to correctly use sanitize_text_field and wp_unslash that doesn't cause psalm to error with "expects string, possibly different type"

PHP AWS Cognito 'Error executing "SignUp" : ResourceNotFoundException : User pool client XXXX does not exist

error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure

java URL working on browser but not in client program

How can I get data from PHP to Android TextView?

About Contact Privacy policy Terms and conditions