473,766 Members | 2,020 Online
Bytes | Software Development & Data Engineering Community
+ 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.Plea se help me for this prob.
Aug 22 '08 #1
9 1561
>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.Plea se help me for this prob.
Then select a database.

Do one of the following:

(1) specify a database when using mysql_real_conn ect().
(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.Plea se 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_d b).
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.com wrote:
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.Plea se 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_d b).
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("us e $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.u ser

C.
Aug 22 '08 #4
C. (http://symcbean.blogspot.com/) wrote:
On 22 Aug, 07:23, Tim Roberts <t...@probo.com wrote:
>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.Plea se 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_d b).
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("us e $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.u ser

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*******@attgl obal.net
=============== ===

Aug 22 '08 #5
ally wrote:
On Fri, 22 Aug 2008 08:46:44 -0400, Jerry Stuckle <js*******@attg lobal.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*******@attgl obal.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.Plea se 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*******@attg lobal.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..interro gate multiple criminal databases across
several police forces and present an integrated view on data to the
detectives...II RC 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*******@att global.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..interro gate multiple criminal databases across
several police forces and present an integrated view on data to the
detectives...II RC 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*******@attg lobal.net>
wrote:
>ally wrote:
>>On Fri, 22 Aug 2008 08:46:44 -0400, Jerry Stuckle <js*******@attg lobal.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*******@attgl obal.net
=============== ===

Sep 2 '08 #10

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

Similar topics

9
12209
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 byte what is returned from a field in a database? Josh
1
2036
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 foo.txt it gets stored in database correctly whereas the file bar.txt gives an error. The error given is: Traceback (most recent call last): File "fakeloginserver.py", line 567, in _doRequest
3
2004
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 gets stored in database correctly whereas the file bar.txt gives an error. The error given is: Traceback (most recent call last): File "fakeloginserver.py", line 567, in _doRequest
6
2624
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 ($word_id,$page_id); ERROR 1054: Unknown column '$word_id' in 'field list'
14
2898
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 statement. I first connect to the database... self.con = MySQLdb.connect(user=username, passwd =password) self.cursor = self.con.cursor() self.cursor.execute("SET max_error_count=0")
1
1668
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 why isn't the script entering info into my row?". Well to awnser your question most servers that you pay for monthly or own will have a anti mysql injection attack. So it will not allow the injection to enter in your database for your protection...
2
5649
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 method like $data=$_post; after this i am inserting in database, mysql_query("insert into tbl_name(column name) values('$data')"); Everthing working fine when we insert simple text in the form,but failing when special character are entered. eg:...
3
2634
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 file looks like this; +----------+---------------------+------+-----+--------- +----------------+ | Field | Type | Null | Key | Default |
6
1898
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
9568
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10008
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9959
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9837
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7381
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6651
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.