PDA

View Full Version : Addresses and URLS


rswyatt
01-15-2005, 05:49 PM
Hello all -

I'm having SERIOUS brain freeze this morning. I'm trying to insert some variables that contain addresses and URLs into mysql using PHP.

The problem is that I'm obviously not formatting them right before the insert.

Does anyone have any examples of what I need to do to address fields and URL fields to prepare them for an INSERT query?

I tried addslashes() and that didn't work. I'm specifically having problems when my variable contains like an apartment number: #20 or a url like: http://www.somedomain.com

Any help is appreciated.

dniwebdesign
01-15-2005, 06:31 PM
well, I get have no problems when I instert a url like http://www.somedomain.ca into my database. My database coloumn is a varchar type.

Paste some of your code so we can see what is wrong...

firepages
01-16-2005, 02:21 AM
try mysql_escape_string() (http://www.php.net/mysql_escape_string)

rswyatt
01-17-2005, 02:15 PM
I'm a dummy - it wasn't the variables at all - it was a malformed SQL query that after looking at 55 times - finally found the error of my ways. :-)

However, thanks for the help and I will check into using the escape_string command - looks good. I usually addslashes to most fields