Programming and Webmasters forum
HomeSearchRecent PostsLoginRegisterContact Us

Username  
Password

Pages: [1]   Go Down
 
  Email this topic  |  Print
0 Members and 1 Guest are viewing this topic.

PHP/MySQL cannot update table?

 
webmaster forum
Anchor  Offline
 
New Coder
Posts: 20
Topics: 16
January 13, 2009, 04:35:03 AM

Hi guys, I have this simple piece of code and I want to be able to update a field in one of my database tables. It keeps saying that 'Error adding:No database selected'...
Can someone please take a look and tell me what I am doing wrong?
 
webmaster forum
polas  Offline
*
 
Code Guru
Gender: Male
Posts: 1296
Topics: 79
WWW
January 13, 2009, 06:13:04 AM

Cut and paste here what the code is, without that its impossible to know where you are going wrong. Are you logging into and selecting the database correctly - from what you have said it seems like there may be an issue there. This topic may help you figure out where you are going wrong, http://www.technicaltalk.net/index.php/topic,623.0.html - make sure you are opening the database like I did in the 1st two lines of the code I posted

Mesham Type Oriented Parallel Programming Language
 
webmaster forum
 
New Coder
Posts: 26
Topics: 12
January 21, 2009, 04:50:27 AM

'Error adding:No database selected'...
only means that you didnt put your data base info...
make sure you will put the databasehost, databasename. databaseuserand databasepassword...

heres an example:
$dbname = "HERE"; //change to your mysql database name
$dbhost = "localhost"; //database host name
$dbuser = "HERE"; //database user
$dbpass = "HERE"; //database password
 
webmaster forum
polas  Offline
*
 
Code Guru
Gender: Male
Posts: 1296
Topics: 79
WWW
January 21, 2009, 07:19:23 AM

From my understanding, it is not enough to simply set those variables, you need to do something with them (such as the functions mysql_connect and mysql_select_db)

Mesham Type Oriented Parallel Programming Language
 
webmaster forum
 
New Coder
Posts: 42
Topics: 4
WWW
July 23, 2009, 07:25:25 AM

Hi guys, I have this simple piece of code and I want to be able to update a field in one of my database tables. It keeps saying that 'Error adding:No database selected'...
Can someone please take a look and tell me what I am doing wrong?

Post your code so we can help you better.

www.m-forums.com - The broadest finance-related discussion forum.
We have just launched and need people to join and contribute. Help is greatly appreciated Smiley
 
webmaster forum
polas  Offline
*
 
Code Guru
Gender: Male
Posts: 1296
Topics: 79
WWW
July 23, 2009, 01:54:31 PM

It is not exactly what you are after, but the code I posted sometime ago on this thread http://www.technicaltalk.net/index.php/topic,623.0.html might be useful

Mesham Type Oriented Parallel Programming Language
 
  Email this topic  |  Print
Pages: [1]   Go Up
 
Jump to:  



Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC


Google visited last this page August 13, 2010, 09:20:56 PM