• 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

renameColumn migration fails for existing column with columns does not exist error

Laravel PHP: multiple project run at the same time [closed]

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'name' cannot be null

Can't remotely connect to MySQL error (13) with PHP script, connecting through CLI works

Add record for each array elements if missing in table

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"

Laravel 5.5 change unauthenticated login redirect url

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'posts.post' doesn't exist

How to assert parameter attribute sub-structures in PHPUnit mock call expectations

How to downgrade or install a specific version of Composer?

WordPress Subquery returns more than 1 row on SELECT

PHP Fatal error: Class not found - PHPUnit

How can i update or reset my password without entering email field in laravel-8?

Error while importing CSV file in database

Laravel print last executed SQL query with Query log

About Contact Privacy policy Terms and conditions