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 tom@yahoo.com world.jpg jackie@hotmail.com stunning.jpg toni@msn.com 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! Quote 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? Quote 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... Quote 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! Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.