Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Puncuation in a WHERE clause

Status
Not open for further replies.

edpatterson

IS-IT--Management
Feb 24, 2005
186
0
0
Oh so close :)

Apache, PHP and odbc to a remote Access database

(sample data, table = log, columns = ip_adress and user_name)
"192.168.22.1","Jones-Bill"
"192.168.22.2","Jones-Jane"
"192.168.22.1","Jones-Bill"
"192.168.22.2","Jones-Jane"
"192.168.22.1","Jones-Bill"
"192.168.22.2","Jones-Jane"

Works
Code:
$sql = "SELECT ip_address, user_name FROM [log] WHERE [user_name] = 'Jones-Bill'";
Does not work
Code:
$sql = "SELECT ip_address, user_name FROM [log] WHERE [ip_address] = '192.168.22.1'";

I have tried using '192\.168\.22\.1' to no avail. I do not know how to properly escape the periods. (I think)

Ed
 




Hi,

Are you sure that there are not trailing spaces?
Code:
$sql = "SELECT ip_address, user_name FROM [log] WHERE TRIM([ip_address]) = '192.168.22.1'";


Skip,
[sub]
[glasses] [red][/red]
[tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top