Page 1 of 1
I'm having a problem with creating a database for my forms.
Posted: Fri Jan 09, 2004 8:22 pm
by zimmer
click here << - I don't understand what is wrong with what I did at that site, if someone has the solution please post, help would be much appreciated.

Posted: Fri Jan 09, 2004 8:28 pm
by Fataqui
Hi
Are you sure you are using the correct username and or password! The second error is caused by the first error ('mysql_connect()')!
F!
Posted: Fri Jan 09, 2004 8:28 pm
by zimmer
I didn't use a password, I don't know what to do (sorry I'm new to php and I'm using the php bible)
Posted: Fri Jan 09, 2004 9:39 pm
by Fataqui
Hi
The database is setup with a password...
This is why you get this! -> (Using password: YES)
MySQL is telling you the error is that 'Access denied', it is also telling you that it is using a password!
What are you trying to run?
F!
Posted: Fri Jan 09, 2004 9:41 pm
by zimmer
I'm trying to make a database to send all of my form information to.
Posted: Sat Jan 10, 2004 2:03 am
by fastfingertips
I'm sending you my database class, it has inside all details that you may need.
Code: Select all
<?php
$mysite['db_server']="localhost"; // This is usually loclhost
$mysite['db_name']=""; // Insert here the database name
$mysite['db_user']=""; // Insert the database user
$mysite['db_pass']=""; // Insert the user password
class database
{
var $DatabaseLink;
var $Connected;
var $CloseConnection;
//This function will opena a database connection to the Mysql Server
function connect()
{
global $mysite;
if(is_null($this->DatabaseLink))
{
$this->DatabaseLink=mysql_connect($mysite['db_server'],$mysite['db_user'],$mysite['db_pass']);
$this->Connected=mysql_select_db($mysite['db_name'],$this->DatabaseLink);
}
return $this->DatabaseLink;
}
function closeconnect()
{
global $mysite;
if(!is_null($this->DatabaseLink))
{
$this->CloseConnection=mysql_close($this->DatabaseLink);
$this->DatabaseLink= NULL;
}
}
}
?>
To build the object
When you want to send a script to your database server you will only have to write this:
Code: Select all
<?php
$result=mysql_query($sql,$sqlpipe->connect());
?>
Posted: Sat Jan 10, 2004 6:09 pm
by zimmer
well, this is the code I'm using and it doesn't work:
<?php
$dbh=mysql_connect ("localhost", "zimmer_greeneggs", "<yes I entered the passowrd here>") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("zimmer_xmb1");
?>
(the username is greeneggs (to the database)
the overall username is zimmer
the database's name is zimmer_xmb1
What am I doing wrong?