I'm new to php and mysql so would appreciate any help. The error message occurs after I press the submit 'look up' button from my drop down list which is supposed to return a list of result from my mysql database.

The error message I'm getting is **Database access failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1**

This is the entire code for my page:

```
<?php // connect to database
require_once 'checklog.php';
require_once 'functions.php';
require_once 'connect.php';
mysqli_select_db($db_server, $db_database);
$str_message = $message = $str_comments = $output = "" ;
if (!$db_server){
        die("Unable to connect to MySQL: " .mysqli_connect_error());
}else{
    // this tests if look up form has an input
    if(trim($_POST['submit']) == "Lookup"){ // set to value of your submit
            if (isset($_POST['choice'])) { //Capture form data, if anything was submitted
                $choice = clean_string($db_server, $_POST['choice']); 
                $query = "SELECT ingredient, alternative, dietID FROM ingredients WHERE ID=$choice";
                mysqli_select_db($db_server, $db_database); // query the database
                $result = mysqli_query($db_server, $query);

                if (!$result) die("Database access failed: " . mysqli_error($db_server));

                if ($row = mysqli_fetch_array($result)) { // if there are any rows, print out the contents
                    $output = 'The healthy alternatives for '  . $row['ingredient'] . ') could be ' . $row['alternative'] . ') which would suit a ' . $row['DietID'] . ') diet ';

                } else {
                    $output = 'The ingredient selected was not found in the database';
                }
                mysqli_free_result($result);
            } else {
                $output = 'No ingredient was selected';
            }
    }

    //Create comments with or without submission
    $query = "SELECT comments.commDate, comments.ID, comments.userID, comments.comment, users.username, comments.image FROM comments LEFT JOIN users ON
comments.userID = users.ID";
    $result = mysqli_query($db_server, $query);
    if (!$result) die("Database access failed: " . mysqli_error($db_server) );
    while($row = mysqli_fetch_array($result)){
        $str_comments .= "<p><em>" . $row['username'] . ": (" . $row['commDate'] .
    ")</em> ";
        //check user is logged in and allow them to delete own comment
        if ($row['userID'] == $_SESSION['userID']){
            $str_comments .=" <a href='delete_post.php?pID=".$row['ID']."'>Delete</a>";
        }
        $str_comments .= "<br />" . $row['comment'] . "</p> <img src='". $row['image']  ."' /><hr />";
    }
    mysqli_free_result($result);
    }
    //Create option with or without submission
    $query = "SELECT * FROM ingredients WHERE dietID='Meat'";
    $result = mysqli_query($db_server, $query);
    if (!$result) die("Query failed: " . mysqli_error($db_server));
    while($row = mysqli_fetch_array($result)){
        $str_options .= "<option value='" . $row[ 'ID'] . "'>";
        $str_options .= $row['ingredient'];
        $str_options .= "</option>";
    }
    mysqli_free_result($result); 

require_once "db_close.php";
include_once("header_logged.php");
?>
<h1> The Chef's Claw Generator</h1>
Here you can use the Chef's Claw Generator to find healthy alternatives to some of the common foods you may have stocked in your fridge or pantry. Choose the generator that suits your current diet, whether you eat meat, you're a vegetarian or you choose to eatt as a vegan. We have lots of alternative healthy options for you to discover.

<p>Hello <?php echo $_SESSION['username'] . " (" . $_SESSION['userID']; ?>)</p>
<!-- DATABASE LOOK UP FORM-->
<form method="post" action="chefsclaw.php">
Which ingredient are you interesting in finding out the healthy alternatives for?
<br>
<br>
<select name="choice">
<?php echo $str_options; ?>
</select>
<br>
<br>
<input type="submit" name="submit" value="Lookup" />
</form>
<hr />

<?php echo $output ?>

<?php include 'footer.php';
?>

```

Many thanks