[prev in list] [next in list] [prev in thread] [next in thread]
List: php-db
Subject: [PHP-DB] Re: mysql_real_escape_string
From: 61.68.192.203
Date: 2007-04-28 6:36:22
Message-ID: DA.BD.29267.088E2364 () pb1 ! pair ! com
[Download RAW message or body]
Ron Piggott wrote:
>
> The following PHP command
>
> $new_maintainers_notes =
> mysql_real_escape_string($new_maintainers_notes);
>
> returned this error while running in a ***cron***.
>
> Warning: mysql_real_escape_string(): Access denied for user:
> 'actsmin@localhost' (Using password: NO)
> in
> /home2/actsmin/actsministries-www/memberservices/administration/ministry_directory_annual_review_maintenance.php
> on line 39
>
> Warning: mysql_real_escape_string(): A link to the server could not be
> established
> in
> /home2/actsmin/actsministries-www/memberservices/administration/ministry_directory_annual_review_maintenance.php
> on line 39
>
> where
>
> $new_maintainers_notes = "Listing has been set for it's annual review";
>
>
>
> But when I return it from the web --- ie http://www........... no
> error.
>
> Any idea why the cron is upset?
>
> Ron
mysql_real_escape_string needs to have an open connection to the db to work.
From the docs - http://www.php.net/mysql_escape_string :
"link_identifier
The MySQL connection. If the link identifier is not specified, the last
link opened by mysql_connect() is assumed. If no such link is found, it
will try to create one as if mysql_connect() was called with no arguments.
If by chance no connection is found or established, an E_WARNING level
warning is generated."
and
"Note: A MySQL connection is required before using
mysql_real_escape_string() otherwise an error of level E_WARNING is
generated, and FALSE is returned. If link_identifier isn't defined, the
last MySQL connection is used."
Cheers
--
David Robley
Some days, nothing goes left.
Today is Pungenday, the 45th day of Discord in the YOLD 3173.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic