android - Why is this a bad MYSQL query in PHP? -


Is this a bad mysql query that I used in php?

  $ tablenamep = $ _POST ["tablenamep"]; $ Res = mysqli_query ($ con, "SELECT * FROM $$ tablenamep` where number = 9");   

So when I try to get the result using:

  while ($ row = mysqli_fetch_assoc ($ res))   

There is a SQL injection error: mysqli_fetch_assoc () parameter 1 is expected to be mysqli_result, given the boolean

I have many questions about this error and The answer is read, but my question is that is a boolean returning query when I added a value for the $ tablenamep variable. I added the value to the variable from my Android app using this code:

  nameValuePairs.add (New BasicNameValuePair ("tablenamep", msg));   

The code is working and there is no error, but when I try to get results of php, my Android app is crashing. How can I solve this! (Note: Nothing wrong in my Android app, I have checked it completely)

Why is this a bad query? What can I do for the query to not return the bullion, and return the original value?

I think your $ res = mysqli_query ($ con, "SELECT * FROM $ tablenamep WHERE number = 9 "); Return fails.

Technical Details Table

For successful selection, show, details, or explore query will return a mysqli_result object. For other successful questions, this truth will come back to failure.

The mysqli_fetch_assoc () function requires mysqli_result but the query fails to return the boolean instead of the object.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -