|
Posted by Rik on 07/25/07 03:46
On Wed, 25 Jul 2007 05:36:00 +0200, <scout3014@gmail.com> wrote:
> Hi
>
> I am using WAMP5 to create web applications. I have a problem as far
> as accessing the database is concerned. This following code is used to=
> access database:
>
> $con =3D mysql_connect("localhost", "root", "");
> if (!con) {
> die('Could not Connect' . mysql_error());
> }
> mysql_select_db("Leave", $con);
> $data =3D mysql_query("SELECT * FROM loginInfo WHERE username=3D" .
> $username);
> if(!$data){
> die('Invalid username: ' . mysql_error());
> }
> else{
> ...... //processing login
> ......
> }
>
> When i activate this code by logging in, the following is shown:
> "Invalid username: No database selected"
>
> I would like to know if there is anything wrong with my database
> connection for my database is correct. My database name on e
> SQLiteManager is 'Leave' and my table is "loginInfo"
0. Echo errors on select_db: mysql_select_db("Leave", $con) or =
die(mysql_error());
1. Does the database exist in MySQL? (if not: mysql_query('CREATE DATABA=
SE =
Leave');)
2. MySQL can be set to disallow capitals in database/tablenames, check t=
he =
config and/or a more appropriate group like comp.databases.mysql if you =
=
have trouble with it ...
-- =
Rik Wasmus
Navigation:
[Reply to this message]
|