unable to login in php mysql

Codes here !

Moderators: macek, egami, gesf

Post Reply
iam4423
New php-forum User
New php-forum User
Posts: 50
Joined: Fri Jan 20, 2012 8:00 am

Re: unable to login in php mysql

Post by iam4423 » Tue Jul 31, 2012 8:54 am

i dont think it will be causing your problem but you dont need

Code: Select all

mysql_query($sql,$con)

Code: Select all

mysql_query($sql)
will get the job done!

there are a few things i would try to resolve this issue firstly put your table and field names inside ` `

Code: Select all

$sql="SELECT * FROM `user` WHERE `LoginName`='$myusername' AND `Password`='$mypassword'";
and if all else fails extract your query from phpmyadmin and then just add your php variables to that. the amount of times ive not been able to work out what was wrong with my query and ive extracted it and still not been able to tell the difference but its worked anyway!

User avatar
freshnet
php-forum Active User
php-forum Active User
Posts: 359
Joined: Tue Feb 22, 2011 8:19 am
Location: Canada

Re: unable to login in php mysql

Post by freshnet » Thu Aug 02, 2012 1:29 pm

The first thing to do is echo back your query and put that into phpmyadmin to see if it runs. Usually that will give you the error, if it isn't obvious just from looking at the echoed query.

Also, you should switch from using mysql to mysqli/PDO as mysql is not secure.

NigelRen
php-forum Fan User
php-forum Fan User
Posts: 622
Joined: Fri Aug 05, 2011 9:53 am

Re: unable to login in php mysql

Post by NigelRen » Thu Aug 02, 2012 11:24 pm

The error your getting is quite specific - the table doesn't exist. Have a look at your database and check that the there is in fact a table called 'user' in the schema you've specified.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests