I need to output not 1 line, but all lines in which the contents of the ua_mails column match the $ search_mail variable.

// класс для работы с БД class DBi { public static $conn; public static $lastquery; public static function get($args) { return self::$conn->$args; } public static function __callStatic($func, $args) { if(is_null(self::$conn)){ self::$conn = new mysqli("ddd.dddddddddd.dd", "bd_aaa", "ccccccccc", "bd_bbb"); // сервер логин пароль база данных if (self::$conn->connect_error) { die('Connect Error (' . self::$conn->connect_errno . ') '. self::$conn->connect_error); } DBi::set_charset("utf8"); } return call_user_func_array(array(self::$conn, $func), $args); } } // простой запрос в БД function mq($sql) { $res = DBi::query($sql); if (!is_bool($res)) $res->free(); } // вставить ряд в БД function mi($sql) { $res = DBi::query($sql); $id = 0; if ($res===true) $id = DBi::get("insert_id"); if (!is_bool($res)) $res->free(); return $id; } // получаем линию в БД function mr($sql) { $res = DBi::query($sql); $row = false; if (!is_bool($res) AND $res->num_rows>0) $row = $res->fetch_assoc(); if (!is_bool($res)) $res->free(); return $row; } // получаем поле из БД function mf($sql,$field) { $res = DBi::query($sql); $row = false; if (!is_bool($res) AND $res->num_rows>0) $row = $res->fetch_assoc(); if (!is_bool($res)) $res->free(); if (isset($row[$field])) return $row[$field]; return false; } // получаем массив в БД function ma($sql) { $res = DBi::query($sql); $rows = array(); if (!is_bool($res) AND $res->num_rows>0) { while ($row = $res->fetch_assoc()) $rows[] = $row; } if (!is_bool($res)) $res->free(); return $rows; } // склеивание и препарирование в SET SQL function sqlset($arr) { $out = array(); foreach ($arr as $k=>$v) { if (is_null($v)) $b = 'NULL'; elseif ($v === "NOW()") $b = 'NOW()'; else $b = "'".DBi::real_escape_string($v)."'"; $k2 = explode('.',$k); $k1 = array_pop($k2); $k2[] = '`'.$k1.'`'; $out[] = implode('.',$k2).' = '.$b; } return implode(', ',$out); } // склеивание и препарирование в Mysql Where function sqlwhere($arr) { $out = array(); foreach ($arr as $k=>$v) { if (is_null($v)) $b = 'NULL'; elseif ($v === "NOW()") $b = 'NOW()'; else $b = "'".DBi::real_escape_string($v)."'"; $k2 = explode('.',$k); $k1 = array_pop($k2); $k2[] = '`'.$k1.'`'; $out[] = implode('.',$k2).' = '.$b; } return implode(' AND ',$out); } $w = ma("select `ua_adress` from `user_acc` where ".sqlwhere("ua_mails"=>$search_mail)); foreach ($w as $li) { echo $li['ua_adress']."<br>"; } 

  • 3
    and what's the problem? - BOPOH
  • does not look like a question, but as a task - lexxl
  • one
    @lexxl, well, the task would be without a code, but here the code is there, it seems to do something like a vskidku, but what is needed from us is not clear. Either the code does not work that way (then how?), Or something else. Author, you don’t like it ...where ".sqlwhere("ua_mails"=>$search_mail)); - should be at least ...where ".sqlwhere(array("ua_mails"=>$search_mail))); But I just glanced at the code, maybe there are some other shoals. All information should be in question, but now it is not clear what exactly your problem is. You may want the code jambs indicated, maybe something else, because There is no question, in fact, - BOPOH
  • The author, perhaps, you here code inspection - lexxl
  • The post was written for me, and I am sincerely grateful for the information provided! - user207721

0