mysql_real_escape_string
am 28.04.2007 01:44:32 von Ron Piggott
--=-W2cOx8FvrwOYhX5ztjQU
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
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/administrat ion/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/administrat ion/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
--=-W2cOx8FvrwOYhX5ztjQU--
Re: mysql_real_escape_string
am 28.04.2007 03:17:33 von bedul
u use localhost right? try ip instead.
127.0.0.1
----- Original Message -----
From: "Ron Piggott"
To: "PHP DB"
Sent: Saturday, April 28, 2007 6:44 AM
Subject: [PHP-DB] mysql_real_escape_string
>
> 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/administrat ion/ministry_dir
ectory_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/administrat ion/ministry_dir
ectory_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
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: mysql_real_escape_string
am 28.04.2007 08:24:22 von robleyd
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/administrat ion/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/administrat ion/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