Answers for "$del_query = "DELETE FROM " . $table; if ($_GET['device'] != '') {"

0

$del_query = "DELETE FROM " . $table; if ($_GET['device'] != '') {

<?php
    //  MySQL table outbox:
    // CREATE TABLE outbox(sender VARCHAR(255), rcpt VARCHAR(255), body VARCHAR(255));
    $mysql_host = "localhost";


    $mysql_base = "school_laravel";

    $mysql_user = "root";

    $mysql_password = "";

    $table = "outbox";

    mysql_connect($mysql_host, $mysql_user, $mysql_password);
    mysql_select_db($mysql_base);

    mysql_query("LOCK TABLES $table WRITE, $table AS $table" . "_read READ");

 $get_query = "SELECT * FROM $table AS $table" . "_read";
 $del_query = "DELETE FROM " . $table;
 if ($_GET['device'] != '') {
  $suffix = " WHERE sender='" . $_GET['device'] . "'";
     $get_query .= suffix;
  $del_query .= suffix;
 }
 $result = mysql_query($get_query);
    echo '<messages>';
    while ($array = mysql_fetch_array($result)) {
  echo '<message msisdn="' . $array['rcpt'] . '">' . $array['body'] . "</message>\n";
 }
 mysql_query($del_query);
 mysql_query("UNLOCK tables");
    echo '</messages>';
?>
Posted by: Guest on April-12-2022

Code answers related to "$del_query = "DELETE FROM " . $table; if ($_GET['device'] != '') {"

Browse Popular Code Answers by Language