Newbie setting up php/mysql database
am 04.04.2007 01:42:15 von it hates me
Greetings
I am trying to setup a mysql database for a php script (OABS)
I've setup a database using my web site control panel (vDeck), and
created a database called:
myname_myname
The configuration script for OABS looks like this:
$flighttable = "OABS_flights";
$customertable = "OABS_customers";
$usertable = "OABS_user";
$offerstable = "OABS_offers";
$adstable = "OABS_adverts";
$sysname1 = "my company";
$maxRows_offers = 4; //The Maximum number of offers shown on the front
page
$domain = "mydomain.com"; //The domain where OABS is, e.g www.google.co.uk
$hostname_Database = "localhost";
$database_Database = "myname_myname";
$username_Database = "username_i_use_to_log_into_controlpanel";
$password_Database = "password_for_my_website_account";
//Do not edit below here
$Database = mysql_pconnect($hostname_Database, $username_Database,
$password_Database) or die(mysql_error());
$opts["hn"] = $hostname_Database;
$opts["un"] = $username_Database;
$opts["pw"] = $password_Database;
$opts["db"] = $database_Database;
$opts["tb"] = $flighttable;
?>
Have I configured the
$hostname_Database
$database_Database
$username_Database
$password_Database
fields correctly?
When I log into the install script for this PHP code I get the error:
No Database Selected
However, it has accepted my username and password correctly! (because
before when this was incorrect, it doesn't respond with no database
selected)
Can you please tell me how to point this php script to the mysql
database I have created using vDeck?
I'm sure this is a small problem to someone who knows what's going on!
Thank you very, very much!
Davy
kingdomoftonga@g mail
Re: Newbie setting up php/mysql database
am 04.04.2007 12:39:10 von Captain Paralytic
On 4 Apr, 00:42, "it hates me" wrote:
> Greetings
>
> I am trying to setup a mysql database for a php script (OABS)
>
> I've setup a database using my web site control panel (vDeck), and
> created a database called:
>
> myname_myname
>
> The configuration script for OABS looks like this:
>
>
> $flighttable = "OABS_flights";
> $customertable = "OABS_customers";
> $usertable = "OABS_user";
> $offerstable = "OABS_offers";
> $adstable = "OABS_adverts";
> $sysname1 = "my company";
> $maxRows_offers = 4; //The Maximum number of offers shown on the front
> page
> $domain = "mydomain.com"; //The domain where OABS is, e.gwww.google.co.uk
>
> $hostname_Database = "localhost";
> $database_Database = "myname_myname";
> $username_Database = "username_i_use_to_log_into_controlpanel";
> $password_Database = "password_for_my_website_account";
>
> //Do not edit below here
> $Database = mysql_pconnect($hostname_Database, $username_Database,
> $password_Database) or die(mysql_error());
>
> $opts["hn"] = $hostname_Database;
> $opts["un"] = $username_Database;
> $opts["pw"] = $password_Database;
> $opts["db"] = $database_Database;
> $opts["tb"] = $flighttable;
>
> ?>
>
> Have I configured the
> $hostname_Database
> $database_Database
> $username_Database
> $password_Database
> fields correctly?
>
> When I log into the install script for this PHP code I get the error:
>
> No Database Selected
>
> However, it has accepted my username and password correctly! (because
> before when this was incorrect, it doesn't respond with no database
> selected)
>
> Can you please tell me how to point this php script to the mysql
> database I have created using vDeck?
>
> I'm sure this is a small problem to someone who knows what's going on!
>
> Thank you very, very much!
> Davy
> kingdomoftonga@g mail
A bit of advice, don't use pconnect, persistant conenctions can be a
pain.
Also, you haven't actually conencted to your database. You set the
variable
$database_Database = "myname_myname";
but you don't use it in any call to mysql to tell it that that is the
database you want it to use.
Re: Newbie setting up php/mysql database
am 04.04.2007 20:07:39 von dinfinity
On Apr 4, 6:39 am, "Captain Paralytic" wrote:
> On 4 Apr, 00:42, "it hates me" wrote:
>
>
>
>
>
> > Greetings
>
> > I am trying to setup a mysql database for a php script (OABS)
>
> > I've setup a database using my web site control panel (vDeck), and
> > created a database called:
>
> > myname_myname
>
> > The configuration script for OABS looks like this:
>
> >
> > $flighttable = "OABS_flights";
> > $customertable = "OABS_customers";
> > $usertable = "OABS_user";
> > $offerstable = "OABS_offers";
> > $adstable = "OABS_adverts";
> > $sysname1 = "my company";
> > $maxRows_offers = 4; //The Maximum number of offers shown on the front
> > page
> > $domain = "mydomain.com"; //The domain where OABS is, e.gwww.google.co.uk
>
> > $hostname_Database = "localhost";
> > $database_Database = "myname_myname";
> > $username_Database = "username_i_use_to_log_into_controlpanel";
> > $password_Database = "password_for_my_website_account";
>
> > //Do not edit below here
> > $Database = mysql_pconnect($hostname_Database, $username_Database,
> > $password_Database) or die(mysql_error());
>
> > $opts["hn"] = $hostname_Database;
> > $opts["un"] = $username_Database;
> > $opts["pw"] = $password_Database;
> > $opts["db"] = $database_Database;
> > $opts["tb"] = $flighttable;
>
> > ?>
>
> > Have I configured the
> > $hostname_Database
> > $database_Database
> > $username_Database
> > $password_Database
> > fields correctly?
>
> > When I log into the install script for this PHP code I get the error:
>
> > No Database Selected
>
> > However, it has accepted my username and password correctly! (because
> > before when this was incorrect, it doesn't respond with no database
> > selected)
>
> > Can you please tell me how to point this php script to the mysql
> > database I have created using vDeck?
>
> > I'm sure this is a small problem to someone who knows what's going on!
>
> > Thank you very, very much!
> > Davy
> > kingdomoftonga@g mail
>
> A bit of advice, don't use pconnect, persistant conenctions can be a
> pain.
>
> Also, you haven't actually conencted to your database. You set the
> variable
> $database_Database = "myname_myname";
> but you don't use it in any call to mysql to tell it that that is the
> database you want it to use.- Hide quoted text -
>
> - Show quoted text -
To add on the comment, what you are missing is this:
mysql_select_db($database_Database, $Database);
add the above right after $Database =
mysql_pconnect($hostname_Database, $username_Database,
$password_Database) or die(mysql_error());