I have a query which I need to run multiple times within a page with different varriables I would need help with creating a function which would do the same as this code:
    $type = "A";
    $getRecordsQuery = "SELECT * from records where domain_id=$domainID and type='". $type ."'" or die("Error:" . \mysqli_error($link));
    $result = mysqli_query($link, $getRecordsQuery);
    if ($result === FALSE) {
die("Error: " . mysqli_error($link));
    } else {
        echo "<table border='1'>
            <tr>
                <td>Name</td>
                <td>IP</td>
                <td>DynDNS</td>
                <td>TTL</td>
            </tr>";
            while ($row = mysqli_fetch_array($result)) {
                $name = $row["name"];
                $ip = $row["content"];
                $ttl = $row["ttl"];
                echo "<tr>
                    <td>". $name ."</td>
                    <td>". $ip ."</td>
                    <td>Off</td>
                    <td>". $ttl ."<td>
                </tr>";
            }
    echo "</table>";
Basically this queries a table from the database and it puts the required information in a table. I would need the function to do the same.
Thanks in advance.
 
     
     
    