I am trying to use a php include to include the mysql connection information in another file for security reasons. I can't seem to get this to work, though. I've created a file, config.php, that looks like this:
| Kód: |
// MySQL host name, user name, password, database, and table
$opts['hn'] = 'url.com';
$opts['un'] = 'user';
$opts['pw'] = 'password';
$opts['db'] = 'dbname';
$opts['tb'] = 'table';
|
Then I put this code into the phpmyedit file:
| Kód: |
| include("config.php"); |
I'm sure I'm missing something small, so I tried adding a forward slash to the link, and later adding php open and close markers in the include code. But still no luck.
Can anyone spot what I'm doing wrong? Thanks a bunch.
Chris
|
| clindsey Napísal: |
I am trying to use a php include to include the mysql connection information in another file for security reasons. I can't seem to get this to work, though. I've created a file, config.php, that looks like this:
| Kód: |
// MySQL host name, user name, password, database, and table
$opts['hn'] = 'url.com';
$opts['un'] = 'user';
$opts['pw'] = 'password';
$opts['db'] = 'dbname';
$opts['tb'] = 'table';
|
Then I put this code into the phpmyedit file:
| Kód: |
| include("config.php"); |
I'm sure I'm missing something small, so I tried adding a forward slash to the link, and later adding php open and close markers in the include code. But still no luck.
Can anyone spot what I'm doing wrong? Thanks a bunch.
Chris |
// MySQL host name, user name, password, database, and table
try this:
mainfile
:
include("config.php");
$opts['hn'] = $host;
$opts['un'] = $user;
$opts['pw'] = $password;
$opts['db'] = $dbname;
$opts['tb'] = $table;
and in the config.php
<?
$host="XXXXX";
$user="XXXXX";
$password="XXXXX";
$dbname="XXXXX";
$table="XXXXX";
?>
|
| clindsey Napísal: |
| This didn't work either. |
please try your way, and use
require_once 'conf.php';
in your phpmyedit script
the config.php must be in the same folder as your phpmyedit script
<?
<-- important signs
// MySQL host name, user name, password, database, and table
$opts['hn'] = 'url.com';
$opts['un'] = 'user';
$opts['pw'] = 'password';
$opts['db'] = 'dbname';
$opts['tb'] = 'table';
?>
<-- important signs
|
whats save file com fopen?
@fopen('/home/user/public_html/db.php', 'w+');
| marrxx Napísal: |
| clindsey Napísal: |
I am trying to use a php include to include the mysql connection information in another file for security reasons. I can't seem to get this to work, though. I've created a file, config.php, that looks like this:
| Kód: |
// MySQL host name, user name, password, database, and table
$opts['hn'] = 'url.com';
$opts['un'] = 'user';
$opts['pw'] = 'password';
$opts['db'] = 'dbname';
$opts['tb'] = 'table';
|
Then I put this code into the phpmyedit file:
| Kód: |
| include("config.php"); |
I'm sure I'm missing something small, so I tried adding a forward slash to the link, and later adding php open and close markers in the include code. But still no luck.
Can anyone spot what I'm doing wrong? Thanks a bunch.
Chris |
// MySQL host name, user name, password, database, and table
try this:
mainfile
:
include("config.php");
$opts['hn'] = $host;
$opts['un'] = $user;
$opts['pw'] = $password;
$opts['db'] = $dbname;
$opts['tb'] = $table;
and in the config.php
<?
$host="XXXXX";
$user="XXXXX";
$password="XXXXX";
$dbname="XXXXX";
$table="XXXXX";
?> |
|
whats save file com fopen?
@fopen('/home/user/public_html/db.php', 'w+');
===
| marrxx Napísal: |
| clindsey Napísal: |
I am trying to use a php include to include the mysql connection information in another file for security reasons. I can't seem to get this to work, though. I've created a file, config.php, that looks like this:
| Kód: |
// MySQL host name, user name, password, database, and table
$opts['hn'] = 'url.com';
$opts['un'] = 'user';
$opts['pw'] = 'password';
$opts['db'] = 'dbname';
$opts['tb'] = 'table';
|
Then I put this code into the phpmyedit file:
| Kód: |
| include("config.php"); |
I'm sure I'm missing something small, so I tried adding a forward slash to the link, and later adding php open and close markers in the include code. But still no luck.
Can anyone spot what I'm doing wrong? Thanks a bunch.
Chris |
// MySQL host name, user name, password, database, and table
try this:
mainfile
:
include("config.php");
$opts['hn'] = $host;
$opts['un'] = $user;
$opts['pw'] = $password;
$opts['db'] = $dbname;
$opts['tb'] = $table;
and in the config.php
<?
$host="XXXXX";
$user="XXXXX";
$password="XXXXX";
$dbname="XXXXX";
$table="XXXXX";
?> |
|