Unable to connect database in php file, urgent

I had created a login page whereby user can login with username and password…database created as well as table by using myqsl php admin (wamp server)… after i try put in the username and password and click submit it show nothing whether i enter correctly or wrongly and still at the same page,anyone can help me please? localhost…I not sure it is the php code problem on link to database or other error… database name I put as test and table as testing :’(


Hi,

Paste the code rather than the screenshot…

Check your column names in that query, there is no column ,1, - think again what columns do you want to pull data from because right now it is checking supplied user name against non-existing column.

And completely forgot - how come your WAMP does not report any error?

Are you referring to the “WHERE 1” statement or something that I didn’t catch?

And the code is mixing mysqli and mysql statements, which may “function” on xAMP development systems since they often set up default mysql connection credentials, but isn’t proper usage. All the database statements need to be from the same extension and the mysql extension shouldn’t be used at all since it has been remove from the latest php version.

Astonecipher

Yes, it does not make any sense to me that part of query ,1, … (i mean i think it is incorrect)

edited/added
:
the columns in his table are ,id, ,username, and ,password, .

Ah. While I agree it doesn’t make sense, it is valid, but it is more a placeholder than anything else. It means, where true; in fact I believe the PHPmyAdmin does it in their queries.

I thought he was pointing at the ,id, (probably unique id) nr 1 in ,id, column and thought that query will link it to username somehow.

Nonetheless, will do some reading on ,where true, since that is something i have not come across/ new to me…

The query, as pictured (don’t know why code cannot simply be pasted), is testing if the ‘$uname’ value (cast to a number) is equal to a literal 1, than AND’ing the true/false value from that comparison with the rest of the where logic.

The 1st part of the logic expression will only be true if ‘$uname’ is ‘1’ or is ‘1followed by any non-numerical character(s) here…’.

The cases where you have seen WHERE 1 or WHERE 1 AND other logic term(s) here, is not comparing the literal 1 with a value and is different from the current query.

Ahh shit. It IS what I said it way, they just didn’t put in the column name and instead just started from that point.

Sponsor our Newsletter | Privacy Policy | Terms of Service