Re: [PHP-DB] mysql_real_escape_string()
My actual question is this line of code: $other = mysql_real_escape_string($other); is giving me this error message: Warning: mysql_real_escape_string(): Access denied for user 'nobody'@'localhost' (using password: NO) in /path/to/file/file.php on line 148 Warning: mysql_real_escape_string(): A link to the server could not be established in /path/to/file/file.php on line 148 You need to connect to the database before you can use mysql_real_escape_string so it can work out database encoding etc. Where the previous server didn't require this I am wondering if there is a line I may add to my .htaccess to by-pass this requirement. My concern is that if I don't find all the instances I will have errors on my site ... this is extensive to correct. You could try using auto_prepend_file (see http://www.php.net/manual/en/ini.core.php). -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] mysql_real_escape_string()
Last week the server my web site hosting company uses went down (along with a bunch of other servers) My files have been moved to another server the company uses. I am in the midst of configuring my site for the new server. Before the server went down I wasn't getting error messages. I know my PHP code is ok. The new server is configured slightly differently. The server is set up with the following: Operating system Linux Kernel version 2.4.21-47.0.1.ELsmp Apache version 1.3.33 (Unix) PHP version 4.3.10 MySQL version 4.1.22-standard I am tweaking my site to make it work. My actual question is this line of code: $other = mysql_real_escape_string($other); is giving me this error message: Warning: mysql_real_escape_string(): Access denied for user 'nobody'@'localhost' (using password: NO) in /path/to/file/file.php on line 148 Warning: mysql_real_escape_string(): A link to the server could not be established in /path/to/file/file.php on line 148 I understand the error message and the request an open connection to the database. Where the previous server didn't require this I am wondering if there is a line I may add to my .htaccess to by-pass this requirement. My concern is that if I don't find all the instances I will have errors on my site ... this is extensive to correct. Suggestions? Ron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mysql_real_escape_string
u use localhost right? try ip instead. 127.0.0.1 - Original Message - From: "Ron Piggott" <[EMAIL PROTECTED]> 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: > '[EMAIL PROTECTED]' (Using password: NO) > in /home2/actsmin/actsministries-www/memberservices/administration/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/administration/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
[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: '[EMAIL PROTECTED]' (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
Re: [PHP-DB] mysql_real_escape_string
Ron Piggott wrote: I am creating a form where I am using $web_site_# for the various fields. At the present time there are 11 fields I am asking the user to key in. I am wondering if there is a slick way to use the mysql_real_escape_string command with this so $web_site_1 = mysql_real_escape_string($web_site_1); $web_site_2 = mysql_real_escape_string($web_site_2); $web_site_3 = mysql_real_escape_string($web_site_3); ... $web_site_11 = mysql_real_escape_string($web_site_11); would be replaced by some type of loop for ($i=1;$i<=11;$i++) ${"web_site_$i"}=mysql_real_escape_string(${"web_site_$i"}}; -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] mysql_real_escape_string
I am creating a form where I am using $web_site_# for the various fields. At the present time there are 11 fields I am asking the user to key in. I am wondering if there is a slick way to use the mysql_real_escape_string command with this so $web_site_1 = mysql_real_escape_string($web_site_1); $web_site_2 = mysql_real_escape_string($web_site_2); $web_site_3 = mysql_real_escape_string($web_site_3); ... $web_site_11 = mysql_real_escape_string($web_site_11); would be replaced by some type of loop Suggestions? Ron
RE: [PHP-DB] mysql_real_escape_string for HTML ???
Hi Ron Use nl2br()...its adds in tags. The other option is to use str_rplace and replace the characters with ones of your choice bastien From: "Ron Piggott" <[EMAIL PROTECTED]> To: "PHP DB" Subject: [PHP-DB] mysql_real_escape_string for HTML ??? Date: Sat, 5 Mar 2005 23:21:14 -0500 I know of the $variable = mysql_real_escape_string($variable); It works just nicely to allow some of the wild cards to be saved to a mySQL table. Is there something like this for HTML that when you retrieve from a variable in the table an ENTER would be converted to I am mainly talking about when the variable is defined as "longtext" and you are expecting the user to write a few sentences or where they may s/he may press ENTER to start a new line. Ron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] mysql_real_escape_string for HTML ???
I know of the $variable = mysql_real_escape_string($variable); It works just nicely to allow some of the wild cards to be saved to a mySQL table. Is there something like this for HTML that when you retrieve from a variable in the table an ENTER would be converted to I am mainly talking about when the variable is defined as "longtext" and you are expecting the user to write a few sentences or where they may s/he may press ENTER to start a new line. Ron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php