Mysql_real_escape_string result empty

Well, if you don’t open a database connection called $pdo, how can you expect to run a query on a non-existent connection?

The tutorial expects that you read and absorb what it says. When it shows that example, it is showing how to execute a query, and probably doesn’t expect to have to point out that first you must connect to the database.

Sorry misunderstanding: I will check if $dpo is open.

By the time you get to that example on the site, you should already have read the section before it, detailing how to open the connection. If your other query is working, you already have that bit.

If you already have a connection called $conn, just use that instead.

(I’m not saying that site is perfect, I hadn’t read any of it until earlier.)

Except $pdo must exist, or the script would have thrown a wobbly on the idea of invoking method query on a non-object.

You’re right, I just tried it and I get “call to member function on null”, so there’s something else happening.

What happened:
I made a php which send the login data, and that works well (now).
To prepare for showing the contents of a table I tried that example.
But I tried perhaps in the wrong script.I will check again

Hit me, now it worked. Spooky, changed nothing, just refresh.