473,473 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

About Inserting values in the MYSQL database

I am not beginer of this language. I've worked on this language for 2
or 3 months.But now i have a problem to inserting values in the
database.It gives me error that DATABASE NOT SELECTED.
I am using wampserver.Please help me for this prob.
Aug 22 '08 #1
9 1544
>I am not beginer of this language. I've worked on this language for 2
>or 3 months.But now i have a problem to inserting values in the
database.It gives me error that DATABASE NOT SELECTED.
I am using wampserver.Please help me for this prob.
Then select a database.

Do one of the following:

(1) specify a database when using mysql_real_connect().
(2) use mysql_select_db() after mysql_connect(). And it would be a
good idea to check if it worked correctly before proceeding.

Remember, you need to use a VALID database name, one you have privileges
to access.
Aug 22 '08 #2
Bunty <bu************@gmail.comwrote:
>
I am not beginer of this language. I've worked on this language for 2
or 3 months.But now i have a problem to inserting values in the
database.It gives me error that DATABASE NOT SELECTED.
I am using wampserver.Please help me for this prob.
Connecting to a MySQL database in PHP requires two steps: one to connect to
the server (mysql_connect), and one to select a database (mysql_select_db).
This is different from many other language/database bindings, where the
connection string specifies the initial database.

My guess is that you forgot mysql_select_db.
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Aug 22 '08 #3
On 22 Aug, 07:23, Tim Roberts <t...@probo.comwrote:
Bunty <bunty.virad...@gmail.comwrote:
I am not beginer of this language. I've worked on this language for 2
or 3 months.But now i have a problem to inserting values in the
database.It gives me error that DATABASE NOT SELECTED.
I am using wampserver.Please help me for this prob.

Connecting to a MySQL database in PHP requires two steps: one to connect to
the server (mysql_connect), and one to select a database (mysql_select_db).
This is different from many other language/database bindings, where the
connection string specifies the initial database.

My guess is that you forgot mysql_select_db.
--
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.
Actually, using mysql_select_db() or mysql_query("use $db") can make
life very complicated if you ever have to develop an application
spanning more than one database.

I've got into the habit of qualifying table names instead, e.g.

SELECT app.* FROM my_db.app, mysql.user
WHERE user.user=app.user

C.
Aug 22 '08 #4
C. (http://symcbean.blogspot.com/) wrote:
On 22 Aug, 07:23, Tim Roberts <t...@probo.comwrote:
>Bunty <bunty.virad...@gmail.comwrote:
>>I am not beginer of this language. I've worked on this language for 2
or 3 months.But now i have a problem to inserting values in the
database.It gives me error that DATABASE NOT SELECTED.
I am using wampserver.Please help me for this prob.
Connecting to a MySQL database in PHP requires two steps: one to connect to
the server (mysql_connect), and one to select a database (mysql_select_db).
This is different from many other language/database bindings, where the
connection string specifies the initial database.

My guess is that you forgot mysql_select_db.
--
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.

Actually, using mysql_select_db() or mysql_query("use $db") can make
life very complicated if you ever have to develop an application
spanning more than one database.

I've got into the habit of qualifying table names instead, e.g.

SELECT app.* FROM my_db.app, mysql.user
WHERE user.user=app.user

C.
Which can still be done, even if you use mysql_select_db().

However, if you find you are often spanning databases in your apps, you
have a major database design problem.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Aug 22 '08 #5
ally wrote:
On Fri, 22 Aug 2008 08:46:44 -0400, Jerry Stuckle <js*******@attglobal.net>
wrote:
>However, if you find you are often spanning databases in your apps, you
have a major database design problem.

--

erm why?

Databases are meant to keep all the information together in one set of
tables. Spreading it out over multiple databases loses that concept.

And while MySQL's "databases" are closer to "schemas" in other
databases, the concept holds true there, also.

It's also a lot easier to backup a single database, and even easier to
change between a development and a production database - just change the
name in one global variable.

But this is getting off topic for a php newsgroup. More info can be
found in a database-related newsgroup.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Aug 22 '08 #6
Bunty ha scritto:
I am not beginer of this language. I've worked on this language for 2
or 3 months.But now i have a problem to inserting values in the
database.It gives me error that DATABASE NOT SELECTED.
I am using wampserver.Please help me for this prob.

please read OFFICIAL manual and use "copy and paste"
_all example works_

http://www.php.net/manual/en/
http://it.php.net/manual/en/function...-select-db.php

Aug 22 '08 #7
ally wrote:
On Fri, 22 Aug 2008 08:46:44 -0400, Jerry Stuckle <js*******@attglobal.net>
wrote:
>However, if you find you are often spanning databases in your apps, you
have a major database design problem.

--

erm why?
Cos jerry says so.

He obviously hasn't had to do what a certain person of my acquaintance
does for a living..interrogate multiple criminal databases across
several police forces and present an integrated view on data to the
detectives...IIRC he does indeed use php as well.
Aug 24 '08 #8
The Natural Philosopher wrote:
ally wrote:
>On Fri, 22 Aug 2008 08:46:44 -0400, Jerry Stuckle
<js*******@attglobal.net>
wrote:
>>However, if you find you are often spanning databases in your apps,
you have a major database design problem.

--

erm why?
Cos jerry says so.

He obviously hasn't had to do what a certain person of my acquaintance
does for a living..interrogate multiple criminal databases across
several police forces and present an integrated view on data to the
detectives...IIRC he does indeed use php as well.
Ambiguity on the word "database" here, I rather fancy.
--
John W. Kennedy
"The bright critics assembled in this volume will doubtless show, in
their sophisticated and ingenious new ways, that, just as /Pooh/ is
suffused with humanism, our humanism itself, at this late date, has
become full of /Pooh./"
-- Frederick Crews. "Postmodern Pooh", Preface
Aug 24 '08 #9
sool wrote:
On Fri, 22 Aug 2008 13:44:34 -0400, Jerry Stuckle <js*******@attglobal.net>
wrote:
>ally wrote:
>>On Fri, 22 Aug 2008 08:46:44 -0400, Jerry Stuckle <js*******@attglobal.net>
wrote:

However, if you find you are often spanning databases in your apps, you
have a major database design problem.

--
erm why?

Databases are meant to keep all the information together in one set of
tables. Spreading it out over multiple databases loses that concept.

And while MySQL's "databases" are closer to "schemas" in other
databases, the concept holds true there, also.

It's also a lot easier to backup a single database, and even easier to
change between a development and a production database - just change the
name in one global variable.

Clearly you are not conversant with how many real world situations operate.
Multiple database access is essential. Perhaps less time spent dealing with
small WWW site applications and more with the more professional and larger
situations would help you understand why that is approaching a "daft" response.

sool
-----------------------


I am VERY conversant with how real world situations operate - I've been
programming for over 40 years (including 13 years with IBM on large
mainframes), and an independent consultant for the last 18. My
experience predates the web by almost 25 years, and some of the
databases I've worked on are larger than anyone here has probably ever seen.

I started designing SQL databases back in the mid 80's - almost 25 years
ago. I have designed some databases larger than you would ever dream.
Of course, this has been on mainframes, not PC's.

But it's also clear from your response you have no real idea about how
to design a database correctly. You've probably never worked with
anything outside of PC's, MySQL and PHP. And you have no idea what
you're talking about.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Sep 2 '08 #10

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

Similar topics

9
by: Joshua Ruppert | last post by:
A section of the documentation for the isSet() function states: Also note that a NULL byte ("\0") is not equivalent to the PHP NULL constant. Where would you encounter a NULL byte? Is a null...
1
by: ketulp_baroda | last post by:
Hi I am storing the attachment in the database. For some file the data gets stored in the database but for other files it gives a MySql error. For eg. when I am trying to attach the file say...
3
by: ketulp_baroda | last post by:
Hi I am storing the attachment in the database. For some file the data gets stored in the database but for other files it gives a MySql error. For eg. when I am trying to attach the file foo.txtit...
6
by: Raqueeb Hassan | last post by:
Hello There! Have you guys tried inserting variables in mySQL tables? Do I have to use 'quote' as we had been doing to insert strings? mysql> INSERT INTO occurrence (word_id,page_id) VALUES...
14
by: Ben | last post by:
I don't know whether anyone can help, but I have an odd problem. I have a PSP (Spyce) script that makes many calls to populate a database. They all work without any problem except for one...
1
Ajm113
by: Ajm113 | last post by:
Ok, when I was new to this I had this problem and I bet a lot of other people did when they where new to PHP and Mysql. So this mite be your question; "Ok, no errors or warnings in mysql and php so...
2
by: Ravigandha | last post by:
Hello everybody, My question is how to insert special characters and symbols in Mysql5 database and how to retrieve them from database in php. Here i am inserting some data from a form,by post...
3
by: len | last post by:
Hi All I have started a little pet project to learn python and MySQL. The project involves figuring out all the combinations for a 5 number lottery and storing the data in a MySQL file. The...
6
by: Bunty | last post by:
I want to insert values in the database.If i insert values one by one then it works till 4 or 5 fields then after it gives error.In my database there are more than 20 field.Pls help me.
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.