0

I'm trying to write a SQL query into PHP variable and then trying write in a PHP file. When I trigger the code, it gives me "Object of class mysqli could not be converted to string in " error.

Here is my variable.

Thanks for your help

$txt = " $conn = mysqli_connect('shareddb1c.hosting.stackcp.net','egitimde-adresim-323044d1','','egitimde-adresim-323044d1');

    mysqli_set_charset($conn, 'utf8');

    $only_query = 'SELECT * FROM anaokulu_veritabani WHERE anaokulu_id = 63';

    $yayinda_query = mysqli_query($conn, $only_query);

    if($yayinda_array = mysqli_fetch_array($yayinda_query)) {

        if($yayinda_array[online] == 0 ) {

            header('Location:http://www.egitimdeadres.com');

        } 

}";
GYaN
  • 2,327
  • 4
  • 19
  • 39

1 Answers1

0

Use single quotes istead of double, because PHP will parse your variables under double quotes. In your example be careful about single quotes inside your string use double quotes or escape them.

Aleksa Arsić
  • 524
  • 1
  • 8
  • 16