Necesito ayuda
Publicado por hans (2 intervenciones) el 15/08/2019 19:50:50
Benas tardes,
Estoy intentando pasar un codigo hecho en PHP5 a 7 y tengo algunos problemas.
Aqui el original:
Aqui el nuevo:
Aqui el mensaje de error: Recoverable fatal error: Object of class stdClass could not be converted to string
Espero que me podeis ayudar a encontrar la solución. Gracias
Estoy intentando pasar un codigo hecho en PHP5 a 7 y tengo algunos problemas.
Aqui el original:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?
public function get_text($p_text_name) {
$text_table = $this->database->table_name_system('text');
$sql = "
SELECT
text_content
FROM
{$text_table}
WHERE
text_name = '{$this->database->escape($p_text_name)}'";
$queries = array(
array(
'sql' => "{$sql} AND text_language_id='{$this->language['language_id']}' AND text_page_id='{$sql_page_id}'",
'error' => false,
'description' => "seitenspezifisch, aktuelle Sprache {$this->language['language_locale_iso_short']}",
));
$found = false;
foreach ($queries as $query) {
$result = $this->database->query_and_fetch($query['sql']);
if ( $result !== false ) {
$found = true;
break;
} else {
if ($query['error'] !== false) {
log::error($query['error'], "Text {$p_text_name} not found ({$query['description']})");
}
}
}
Aqui el nuevo:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Get result set as array of objects
public function resultset(){
$this->execute();
return $this->stmt->fetchAll(PDO::FETCH_ASSOC);
}
public function get_text($p_text_name) {
$text_table = $this->database->table_name_system('text');
$this->database->query("SELECT text_content FROM {$text_table} WHERE text_name=:text_name");
$this->database->bind(':text_name',$p_text_name);
$sql = $this->database->resultset();
Aqui el mensaje de error: Recoverable fatal error: Object of class stdClass could not be converted to string
1
2
Notice: Array to string conversion in
'sql'=> "{$sql} AND text_language_id='{$this->language['language_id']}' AND text_page_id='{$sql_page_id}'",
Espero que me podeis ayudar a encontrar la solución. Gracias
Valora esta pregunta


0