473,405 Members | 2,421 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

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("SELECT * 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 2742
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("SELECT * 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*******@attglobal.net
==================
Jul 25 '07 #2
Rik
On Wed, 25 Jul 2007 05:36:00 +0200, <sc*******@gmail.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("SELECT * 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('CREATE 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...@attglobal.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("SELECT * 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...@attglobal.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...@attglobal.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("SELECT * 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?

- 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*******@attglobal.net
==================
Jul 25 '07 #5

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

Similar topics

10
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...
2
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 +...
0
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...
2
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...
13
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...
7
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...
2
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....
1
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...
19
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 ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.