Catchable fatal error: Object of class mysqli could not be converted to string

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Senior Backend developer - Automotive

We are looking for a highly motivated and experienced Backend developer. Required Qualifications: ● 6+ years experience with a server-side programming technology ● Experience with SQL Databases ● Experience with Go(lang) ● Experience with GCP ● Hands-on test-driven development (TDD), data analytics, and SQL experience ● Experience in producing REST and RPC based services ● Experience building secure and highly-available distributed systems/microservices ● Experience with Git-based versioning and Git workflows ● Knowledge of Redis, Docker, Setting up CI/CD pipelines and Unix command line ● Knowledge of Jira and Scrum techniques ● Excellent communication skills ● Must be a self-starter with

Bekijk vacature »

Louis Deconinck

Louis Deconinck

18/05/2014 13:51:12
Quote Anchor link
Ik krijg deze error: Catchable fatal error: Object of class mysqli could not be converted to string in public_html/index.php on line 17

Wat doe ik verkeerd en hoe kan ik het probleem oplossen?

Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
<?php
ini_set('display_errors', 1); // 0 = uit, 1 = aan
error_reporting(E_ALL);

$link=mysqli_connect("*****","****","*****","*****");

$result1 = mysqli_query($link, "SELECT * FROM main");
$num_rows = mysqli_num_rows($result1);

$person1=rand(1, $num_rows);
$person2=rand(1, $num_rows);

while ($person2 == $person1) {
$person2=rand(1, $num_rows);
}


$result2 = mysqli_query("$link, SELECT * FROM main WHERE id=$person1");
$row1 = mysqli_fetch_row($result2);
$fbid1=$row1['fbid'];

$result3 = mysqli_query("$link, SELECT * FROM main WHERE id=$person2");
$row2 = mysqli_fetch_row($result3);
$fbid2=$row2['fbid'];

echo "$fbid1 en $fbid2";
?>
 
PHP hulp

PHP hulp

16/09/2021 18:29:23
 
Erwin H

Erwin H

18/05/2014 14:25:16
Quote Anchor link
Kijk gewoon eens naar die regel 17:
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
<?php
//niet zo:
$result2 = mysqli_query("$link, SELECT * FROM main WHERE id=$person1");

//maar zo:
$result2 = mysqli_query($link, "SELECT * FROM main WHERE id=$person1");
?>
Gewijzigd op 18/05/2014 14:25:36 door Erwin H
 
Louis Deconinck

Louis Deconinck

18/05/2014 15:12:13
Quote Anchor link
Idd, dat was de oplossing, tnx
 



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.