ОК, поэтому я использую OOPHP для связи между Flash Builder и MYSQL, обе функции работают, но когда я вызываю одну из функций внутри другой, она выдает ошибку
ОШИБКА: ошибка сервера Ошибка MySQL - 2014 У меня естьискать в Интернете и не могу найти подходящих ответов.
Это потому, что первая функция заблокирована в базе данных MYSQL, а вторая не может получить доступ к базе данных?
Причина, по которой у меня возникла эта проблемаВ одной таблице у меня есть страна-клиент в качестве инициалов, и я создал вторую таблицу с тем, что обозначают инициалы, например, Великобритания = Великобритания, я сделал это так, как мне кажется, я думал, что это будет хорошей практикой в отношении баз данных для экономии места.если в таблице клиента было много записей.
Так что теперь я вызываю функцию, которая дает мне конкретного клиента, но в рамках этого вызова я хотел вызвать вторую функцию, чтобы изменить инициалы страны на правильную строку страны.
ПЕРВАЯ ФУНКЦИЯ
public function getClients($item) {
$stmt = mysqli_prepare($this->connection, "SELECT timestamp, id, fname, lname, dateofbirth, monthofbirth, yearofbirth,
town, country, sex, rate, comments from $this->tablename WHERE (id = $item)");
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
$rows = array();
mysqli_stmt_bind_result($stmt, $row->timestamp, $row->ID, $row->fname, $row->lname, $row->dateofbirth, $row->monthofbirth,
$row->yearofbirth, $row->sex, $row->country, $row->town, $row->rate, $row->comments);
while (mysqli_stmt_fetch($stmt)) {
$row->fname = ucfirst(substr($row->fname,0,1));
$row->lname = ucfirst($row->lname);
$row->town = ucfirst($row->town);
$row->comments = strip_tags($row->comments);
$row->lname = (($row->fname) . " " . ($row->lname));
$row->country = $this->getCountry($row->country);
$row->yearofbirth = GetAge($row->dateofbirth. '-' .$row->monthofbirth. '-' .$row->yearofbirth);
$row->Pic_loc = "";
$row->Pic_loc= "SLAGSIMAGES/".($row->ID)."/image01.jpg";
$row->timestamp = new DateTime($row->timestamp);
$rows[] = $row;
$row = new stdClass();
mysqli_stmt_bind_result($stmt, $row->timestamp, $row->id,$row->fname,$row->lname,$row->sex,$row->country,$row->town,$row->dateofbirth,
$row->monthofbirth,$row->yearofbirth, $row->rate, $row->comments);
}
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
return $rows;
}
И это вторая функцияunction, который вызывается первым
public function getCountry($countrycode) {
$stmt = mysqli_prepare($this->connection, "SELECT country FROM countrycodes where CountryCodes ='$countrycode'");
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
$rows = array();
mysqli_stmt_bind_result($stmt, $row->country);
while (mysqli_stmt_fetch($stmt)) {
$rows[] = $row;
$row = new stdClass();
mysqli_stmt_bind_result($stmt, $row->country);
}
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
return $rows;
}
Это фрагмент кода в первой функции, которая выдает ошибку $row->country = $this->getCountry($row->country);
Извините, если код немного сбивает с толку, но спасибо взаранее за любой правильный ответ или информацию, чтобы сообщить моему мозгу, почему это не может быть сделано.