|
Posted by Daedalus.OS on 06/06/05 12:50
It looks like the include failed. What is the php error_reporting level ?
The fact is that if E_WARNING is not on, a simple include will fail
silently. When you include file that the rest of your code rely on, it is
good to use require() instead of include(). require() will throw a fatal
error on failure. A couple of other thing to check... Your path to include
the file is probably wrong. Remember that when you include a file with
relative path this relative path is based on the php file your running. Say
you have a index.php in the webroot folder that include
'some/path/to/fun.inc', say you also have a 'some/path/to/var.inc' file. If
you want to include var.inc from func.inc, you would still have to specify
the relative path based on index.php. So index
include('some/path/to/func.inc') is ok. But in func.inc include('var.inc')
is wrong even if they sit in the same folder because the folder where
index.php sits is the pwd.
Dae
"Lee David" <affordable_turnkey_solutions@comcast.net> wrote in message
news:4ZudnfQa3KBAAT7fRVn-tA@comcast.com...
> Here is the warning:
> Warning: mysql_connect(): Access denied for user: 'root@localhost' (Using
> password: NO) in /home/u1/mokenabarber/html/SQL_Notice_Add.inc on line 19
> Access denied for user: 'root@localhost' (Using password: NO)
>
> Here is line 19 (and there abouts):
> $id = $_POST[id];
> $msg = $_POST[msg];
>
> $name_connect = mysql_connect($cont, $user, $pwrd) or
> die(mysql_error());
> $db_connect = mysql_select_db($name_db, $name_connect) or
> die(mysql_error());
>
> $name... is line 19.
>
> "Oli Filth" <catch@olifilth.co.uk> wrote in message
> news:K8Moe.10214$cN2.2567@newsfe4-gui.ntli.net...
>> Lee David said the following on 06/06/2005 00:36:
>>> Here is "SQL_A_Connect.inc"
>>> // database connection include;
>>> $user = "me";
>>> $pwrd = "password";
>>> $cont = "localhost";
>>> $name_db = "database";
>>> // end include;
>>>
>>> Here is one of the pages I'd like to call it "SQL_Notice_Add.inc":
>>> <?php
>>> if (isset($_POST[postaction]))
>>> {
>>> include("SQL_A_Connect.inc");
>>>
>>> $name_table = "notices";
>>>
>>> $time = date("Y-m-d h:m:s", time());
>>> $time2 = $_POST[exp];
>>> $time2 = ($time2 * 24 * 60 * 60) + time();
>>> $time2 = date("Y-m-d h:m:s", $time2);
>>> $id = $_POST[id];
>>> $msg = $_POST[msg];
>>>
>>> and here is the page that has that include in it (SQL_Notice.php):
>>> <td width="80%">
>>> <?php
>>> include("SQL_Notice_" . $act . ".inc");
>>> ?>
>>> </td>
>>>
>>> If the connection information include isn't there and the raw code it,
>>> it works just find.
>>>
>>
>> Where are you performing the SQL query that causes the error?
>>
>> --
>> Oli
>
>
[Back to original message]
|