Checking for all query parameters before inserting into a database The code works as it is but it's very messy. Is there a way to clean up the null checking in the if statement?

public function submitCoil ($data) {
    $db = Database::getInstance();

    //Define certain query values
    $uniqueID = $this-&gt;hash("id");
    $queryData = array(
        'fields' =&gt; array(
            'uniqueid',
            'uploaded',
            'name',
            'resistance',
            'wrapped',
            'category',
            'description',
            'wraps',
            'images',
            'wire_one',
            'wire_two',
            'wire_three',
            'wire_four',
            'wire_five',
            'wire_six'
        ),
        'values' =&gt; array(
            'uniqueID' =&gt; $uniqueID,
            'uploaded' =&gt; date("F j, Y", time()),
            'name' =&gt; $data['name'],
            'resistance' =&gt; $data['resistance'],
            'wrapped' =&gt; $data['wrapped'],
            'category' =&gt; $data['category'],
            'description' =&gt; $data['description'],
            'wraps' =&gt; $data['wraps'],
            'images' =&gt; "coils/" . $uniqueID . "/",
            'wire_one' =&gt; $data['wire_one'],
            'wire_two' =&gt; $data['wire_two'],
            'wire_three' =&gt; $data['wire_three'],
            'wire_four' =&gt; $data['wire_four'],
            'wire_five' =&gt; $data['wire_five'],
            'wire_six' =&gt; $data['wire_six']
        )
    );

    //Make sure mandatory datas are filled out
    if (!empty($queryData['values']['name']) &amp;&amp; !empty($queryData['values']['resistance']) &amp;&amp; !empty($queryData['values']['wrapped']) &amp;&amp; !empty($queryData['values']['description']) &amp;&amp; !empty($queryData['values']['wraps'])) {
        $db-&gt;insertFew("coils", $queryData['fields'], $queryData['values']);
    } else {
        echo "Please fill all fields";
    }
Use a validation function
There are many possible solutions, one thing you can do is use a separate function to validate your data:
public function submitCoil($data)
{
    ...
    if (!$this-&gt;validates($queryData['values'])) {
        return false;
    }

    return $db-&gt;insertFew(&quot;coils&quot;, $queryData['fields'], $queryData['values']);
}

protected function validates($values)
{
    $mandatoryFields = ['name', 'resistance', 'description', 'wraps'];

    $return = true;

    foreach ($mandatoryFields as $field) {
        if (empty($values[$field])) {
            // Consider doing something like this so you can know/say
            // what the problem is.
            // $this-&gt;validationErrors[$field] = &quot;This is empty&quot;;
            $return = false;
        }
    }

    return $return;
}

This function simply loops on all the keys that you specify as needing to be not-empty and returns true only if they are all populated.
Many simple functions
Always strive to have simple functions, that do one thing - for example:
public function submitCoil($data)
{
    $queryData = $this-&gt;translateData($data);
    if (!$this-&gt;validates($queryData['values'])) {
        return false;
    }
    return $this-&gt;insert($queryData);
}

protected function translateData($data)
{
    $uniqueID = $this-&gt;hash(&quot;id&quot;);
    return [
        'fields' =&gt; [
            'uniqueid',
            'uploaded',
            'name',
            'resistance',
            'wrapped',
            'category',
            'description',
            'wraps',
            'images',
            'wire_one',
            'wire_two',
            'wire_three',
            'wire_four',
            'wire_five',
            'wire_six'
        ],
        'values' =&gt; [
            'uniqueID' =&gt; $uniqueID,
            'uploaded' =&gt; date(&quot;F j, Y&quot;, time()),
            'name' =&gt; $data['name'],
            'resistance' =&gt; $data['resistance'],
            'wrapped' =&gt; $data['wrapped'],
            'category' =&gt; $data['category'],
            'description' =&gt; $data['description'],
            'wraps' =&gt; $data['wraps'],
            'images' =&gt; &quot;coils/&quot; . $uniqueID . &quot;/&quot;,
            'wire_one' =&gt; $data['wire_one'],
            'wire_two' =&gt; $data['wire_two'],
            'wire_three' =&gt; $data['wire_three'],
            'wire_four' =&gt; $data['wire_four'],
            'wire_five' =&gt; $data['wire_five'],
            'wire_six' =&gt; $data['wire_six']
        ]
    ];
}

protected function validates($values)
{
    $mandatoryFields = ['name', 'resistance', 'description', 'wraps'];

    foreach ($mandatoryFields as $field) {
        if (empty($values[$field])) {
            return false;
        }
    }

    return true;
}

protected function insert($data)
{
    $db = Database::getInstance();
    return $db-&gt;insertFew(&quot;coils&quot;, $data['fields'], $data['values']);
}

This allows the building-blocks to be changed - or used individually. It also aides readability/maintainability as it is much clearer at a glance what a function does (assuming methods are well-named).
Avoid repetition
The fields and array keys for the values key in $queryData look to serve the same purpose - although they are different. You don't need 'fields' if the keys can be used i.e.:
$queryData = [
    'uniqueid' =&gt; $uniqueID,
    'uploaded' =&gt; date(&quot;F j, Y&quot;, time()),
    'name' =&gt; $data['name'],
    'resistance' =&gt; $data['resistance'],
    'wrapped' =&gt; $data['wrapped'],
    'category' =&gt; $data['category'],
    'description' =&gt; $data['description'],
    'wraps' =&gt; $data['wraps'],
    'images' =&gt; &quot;coils/&quot; . $uniqueID . &quot;/&quot;,
    'wire_one' =&gt; $data['wire_one'],
    'wire_two' =&gt; $data['wire_two'],
    'wire_three' =&gt; $data['wire_three'],
    'wire_four' =&gt; $data['wire_four'],
    'wire_five' =&gt; $data['wire_five'],
    'wire_six' =&gt; $data['wire_six']
];

$db-&gt;insertFew(&quot;coils&quot;, array_keys($queryData), array_values($queryData));

This alone makes the method body much shorter.