Okay, so that saves me crap, and I can't find anything in the PHP documentation and anywhere else in the resulting Google area, so maybe someone can help here.
I use prepared instructions, linking the results, and then using these related results to populate the drop-down list. Example:
<option value="">Select artist</option>
<?php
$artistQuery = "SELECT ArtistID,ArtistName FROM Artist_v";
if($artist = mysqli_prepare($link,$artistQuery)){
mysqli_stmt_execute($artist);
$artistResult = mysqli_stmt_bind_result($artist,$artistID,$artistName);
while(mysqli_stmt_fetch($artist)){
?>
<option value="<?php echo $artistID; ?>"><?php echo $artistName; ?></option>
<?php
}
mysqli_stmt_close($artist);
}
?>
<option value="Other">Add new...</option>
There is something that you may notice is a little strange. Namely:
$artistResult = mysqli_stmt_bind_result($artist,$artistID,$artistName);
There is no reason in the PHP documentation for mysqli_stmt_bind_result to capture this result in a variable, something like this should be just fine:
mysqli_stmt_bind_result($artist,$artistID,$artistName);
, , , . , , , . ... . mysqli_error(), error_reporting(E_ALL); ini_set('display_errors', '1');, , ... .
, , -... , . (), PHP , () /. , .
- ?
, , , ... , , .