MySQL Forums
Forum List  »  Newbie

Re: Why is my mysql code not working?
Posted by: Phillip Ward
Date: October 18, 2021 05:22AM

Quote

what is wrong with my code?

I'm guessing that you're learning PHP.

This is an assignment statement in which you're taking a String value and putting it into the variable called sql.

sql="SELECT * FROM `covid_pass`";

Only the bit inside the double-quotes means anything to MySQL so, inside the mysql client or MySQL Workbench, that's the bit you need to use:

SELECT * FROM covid_pass;

And, while we're about it, don't use "select *" in Application code.
Always specify the columns that you want to retrieve explicitly.

Regards, Phill W.

Options: ReplyQuote


Subject
Written By
Posted
Re: Why is my mysql code not working?
October 18, 2021 05:22AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.