How to retrieve enum values in PHP

Hi, I tried to retrieve values of enum but I get empty values. I can retrieve normal values. Can you help Please ?

this is the code

[php] <?php
session_start();
require ‘common.php’;
$connection = new mysqli($localhost, $dusername, $dpassword, $database);
if ($connection->connect_error) {
die("Connection failed: " . $connection->connect_error);
}
?>

        <label><b>Blood Type</b></label>
        <select name = "BloodType" id="BloodType">
            <option>Blood Type</option>
            <?php

if ($stmt = $connection->query(“select BloodType from patient”)) {
while ($r = $stmt->fetch_array(MYSQLI_ASSOC)) {
?>
<?php
echo $r[‘BloodType’];
?>

            <?php
}

}
?>

        </select>[/php]

What values is it giving back?

Enumerated column types just limit what can go into a column, they don’t set the entire list. When you do a select what is the actual returned value?

Thank you for you response

I have 4 values in enum in DB and I get 2 empty values in drop list


1.png

Edited my response.

Not using the select as the output, what do you get back?

Sponsor our Newsletter | Privacy Policy | Terms of Service