I'm trying to do something, but it doesn't work out, the primary suspect is incorrect query, but I don't know whether it's correct or not. I could try running it in phpMyAdmin, but then I don't know how these are escaped. The result is: array(5) { ["current_field"]=> NULL ["field_count"]=> NULL ["lengths"]=> NULL ["num_rows"]=> NULL ["type"]=> NULL }. So I figured maybe the query, maybe something else.

mysqli_query("SELECT * FROM members WHERE email='" . $_POST["inputEmail"] . "' OR username='" . $_POST["inputUsername"] . "'");

Does this get parsed properly? Given that $_POST's are alphanumerical?

Recommended Answers

All 2 Replies

Ah, this is a simple fix. You don't put the query in the mysqli_query()

This is what you would do:

$sql= "SELECT * FROM member WHERE email='" . $_POST['inputEmail']. "'";
 $result = mysqli_query($conn, $sql);

and the $conn would be the variable you have for the connection to the database, so that name could be different in yours for your connect.
Hope this helps!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.