473,545 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

accessing database in wamp environment

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 = mysql_connect(" localhost", "root", "");
if (!con) {
die('Could not Connect' . mysql_error());
}
mysql_select_db ("Leave", $con);
$data = mysql_query("SE LECT * FROM loginInfo WHERE username=" .
$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"

Help is much appreciated

Regards
Eugene

Jul 25 '07 #1
4 2750
sc*******@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 = mysql_connect(" localhost", "root", "");
if (!con) {
die('Could not Connect' . mysql_error());
}
mysql_select_db ("Leave", $con);
$data = mysql_query("SE LECT * FROM loginInfo WHERE username=" .
$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"

Help is much appreciated

Regards
Eugene
What's the result of your mysql_select_db call? It returns true/false
depending on whether the request worked/failed. If you get false back,
what's the error?

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jul 25 '07 #2
Rik
On Wed, 25 Jul 2007 05:36:00 +0200, <sc*******@gmai l.comwrote:
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 = mysql_connect(" localhost", "root", "");
if (!con) {
die('Could not Connect' . mysql_error());
}
mysql_select_db ("Leave", $con);
$data = mysql_query("SE LECT * FROM loginInfo WHERE username=" .
$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('CR EATE DATABASE
Leave');)
2. MySQL can be set to disallow capitals in database/tablenames, check the
config and/or a more appropriate group like comp.databases. mysql if you
have trouble with it ...

--
Rik Wasmus
Jul 25 '07 #3
On Jul 25, 11:45 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
scout3...@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 = mysql_connect(" localhost", "root", "");
if (!con) {
die('Could not Connect' . mysql_error());
}
mysql_select_db ("Leave", $con);
$data = mysql_query("SE LECT * FROM loginInfo WHERE username=" .
$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"
Help is much appreciated
Regards
Eugene

What's the result of your mysql_select_db call? It returns true/false
depending on whether the request worked/failed. If you get false back,
what's the error?

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attgl obal.net
=============== ===- Hide quoted text -

- Show quoted text -
if (!mysql_select_ db("leave", $con)){
die (mysql_error()) ;
}

using the following code, the error message is as shown:
Unknown database 'leave'

Like i was saying my database name was "Leave" with capital L so i do
not know why they put in in small case

Jul 25 '07 #4
sc*******@gmail .com wrote:
On Jul 25, 11:45 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
>scout3...@gmai l.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 = mysql_connect(" localhost", "root", "");
if (!con) {
die('Could not Connect' . mysql_error());
}
mysql_select_ db("Leave", $con);
$data = mysql_query("SE LECT * FROM loginInfo WHERE username=" .
$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
SQLiteManag er is 'Leave' and my table is "loginInfo"
Help is much appreciated
Regards
Eugene
What's the result of your mysql_select_db call? It returns true/false
depending on whether the request worked/failed. If you get false back,
what's the error?

- Show quoted text -

if (!mysql_select_ db("leave", $con)){
die (mysql_error()) ;
}

using the following code, the error message is as shown:
Unknown database 'leave'

Like i was saying my database name was "Leave" with capital L so i do
not know why they put in in small case
Well, I'm not sure who "they" is - but looks like you need to change the
mysql_select_db call.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jul 25 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
3502
by: Andrea M. Segovia | last post by:
Hello, I am a newbie to Oracle databases.... We have a visualization front-end tool connected to an Oracle back-end database on a Tru64 UNIX server. We also have clients with MS access databases who would like to share their data using this visualization tool but do not want to import their data into the Oracle server back-end.
2
6892
by: Yogee | last post by:
Hello all, I dont know the exact group where I should post my questions. So, I m doing it on most of the groups which support components of LAMP stack. My client wants to use WAMP ( Windows + apache + MySQL + PHP ). But the site performance is very slow on windows. I dont know the exact reasons. I have seen some benchmark details on...
0
1821
by: John Fleming | last post by:
Hello, I am building a web application with the following components: 2 Web Servers - Windows Server 2003 - IIS 6 - .Net Framework version 2.0 - Reside in Domain A 2 Clustered Database Servers
2
3101
by: Mike | last post by:
I running MySQL locally and have the following dir setup C:\wamp\mysql\data\mike - This is where the tables for the database mike are stored C:\wamp\mysql\data - This is where I think the database data is stored. Basically the file in the data dir. (ibdata1) is 10,240kb in size. When I update a table in the mike database the file size...
13
2357
by: Vesuvius2001 | last post by:
hi im wondering is anyone can help me with this peice of code what i am trying todo is to create a register page where users type information which goes into a database heres the code FORM CODE <html> <head> <title>Signup Form</title>
7
1303
by: rodeoval | last post by:
hi! I'm completely new to PHP and MySQL and I am using WAMP 5.This is something I extracted from a web tutorial. Although it is to create a table called students in a database named College it does not create one. Can someone pls show me where I have gone wrong in the following codings? <? $username="root"; $password="";...
2
2954
by: robin1983 | last post by:
Hi, how are u all? I am using wamp for my php program to run. Actually, i m installing the in my system. Actually, i want to know is it possible to access the program from other system in my LAN. suppose my system ip address is 192.168.1.11 and i want to run the php program from a system who's IP address is 192.168.1.12. When I execute in my ...
1
4316
by: fatalparadox | last post by:
I had WAMP Server installed for a few months, everything was fine. Now all of a sudden it stopped working. It still executes the PHP but it doesn't allow me to write to a .txt file anymore. When I put the same files on the web it works great. And it worked with wamp server before yesterday. So I uninstalled WAMP server and installed WAMP...
19
9090
by: obtrs | last post by:
I have some code for drop down its not working it gives the errors every thing looks fine to me help me out. Errors Notice: Undefined index: from in C:\wamp\www\site\booking.php on line 6 Notice: Undefined index: to in C:\wamp\www\site\booking.php on line 8 Notice: Undefined index: couch in C:\wamp\www\site\booking.php on line 10
0
7473
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7406
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7660
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7813
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7431
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5976
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5337
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1888
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.