Reply to Re: Newbie setting up php/mysql database

Your name:

Reply:


Posted by dinfinity on 04/04/07 18:07

On Apr 4, 6:39 am, "Captain Paralytic" <paul_laut...@yahoo.com> wrote:
> On 4 Apr, 00:42, "it hates me" <kingdomofto...@gmail.com> 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:
>
> > <?php
> > $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());

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация