|
Posted by J.O. Aho on 03/01/07 06:11
Ron wrote:
> Hi all,
>
> I connect to my database in a way that I think is pretty unsecure.
> What I have works well so I haven't messed with it but maybe I could
> get a suggestion or two? I keep finding the script examples that
> taught me to make the connection in the first place
>
> I use:
> <?
> $dbh=mysql_connect ("localhost", "database", "password")
> or die ('I cannot connect to the database because: ' . mysql_error());
> mysql_select_db ("database_table");
> echo "<p>Database selected...\n";
>
> and on to echoing out my list through a loop.
>
> Is there a way to call the the database and password info from an
> external file. Is there a different version of an include?
>
> Any help or leads would be appreciated
You can use include()/required_once() to include the file with the connection,
you place it outside the web directory in a location where you can't access it
directly with a browser.
--
//Aho
Navigation:
[Reply to this message]
|