bulgin Posted February 16, 2009 Share Posted February 16, 2009 I have a table web2_access_log with a field request_uri that always has a uri as such in it: /universe.jpg /world.jpg /stunning.jpg I also have a cust database with file_names and email_addresses as such, for example: file_names email_addresses universe.jpg [email protected] world.jpg [email protected] stunning.jpg [email protected] I'm trying to get the matches between the data with the following command, and it works if I first manually remove the forward slash from each record in the web2_access_log field (can't do that all day long) , but not if I try to use the following formula. What am I missing here? SELECT substring( web2_access_log.request_uri FROM 1 ), cust.file_names, cust.email_addresses FROM web2_access_log JOIN cust ON substring(web2_access_log.request_uri FROM 1) = cust.file_names I'm stumped and would appreciate any help that a guru could might spare. Thanks! Link to comment https://forums.phpfreaks.com/topic/145369-solved-my-substring-function-does-not-work/ Share on other sites More sharing options...
fenway Posted February 16, 2009 Share Posted February 16, 2009 Huh? Link to comment https://forums.phpfreaks.com/topic/145369-solved-my-substring-function-does-not-work/#findComment-763211 Share on other sites More sharing options...
MegamanNL Posted February 16, 2009 Share Posted February 16, 2009 SELECT SUBSTRING(web2_access_log.request_uri FROM 2) or SELECT SUBSTRING(web2_access_log.request_uri, 2) Substring is 1-bases, not 0-based... Link to comment https://forums.phpfreaks.com/topic/145369-solved-my-substring-function-does-not-work/#findComment-763215 Share on other sites More sharing options...
bulgin Posted February 16, 2009 Author Share Posted February 16, 2009 Ver 14.12 Distrib 5.0.67, for debian-linux-gnu (i486) using readline 5.2 It turns out that the first recommendation above, which I did try, doesn't work, but the second one did: This is what worked: SELECT SUBSTRING(web2_access_log.request_uri, 2) thanks for the suggestion and help! Link to comment https://forums.phpfreaks.com/topic/145369-solved-my-substring-function-does-not-work/#findComment-763409 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.