function getID($position) { $sql = "SELECT * FROM chat ORDER BY id DESC LIMIT " . $position . ",1"; $conn = getDBConnection(); $results = mysql_query($sql, $conn); if (!$results || empty($results)) { //echo 'There was an error creating the entry'; end; } while ($row = mysql_fetch_array($results)) { $id = $row[0]; //the result is converted from the db setup (see initDB.php) } if ($id) { deleteEntries($id); //deletes all message prior to a certain id } }
function getID($position) { include "../include/settings.php"; # getting table prefix $sql = "SELECT * FROM {$TABLE_PREFIX}chat ORDER BY id DESC LIMIT " . $position . ",1"; $conn = getDBConnection(); $results = mysqli_query($conn, $sql); if (!$results || empty($results)) { # echo 'There was an error creating the entry'; end; } while ($row = mysqli_fetch_array($results)) { $id = $row[0]; # the result is converted from the db setup (see conn.php) } if ($id) { deleteEntries($id); # deletes all message prior to a certain id } }