deansaddigh Posted January 6, 2010 Share Posted January 6, 2010 1. $search = "AND (p.propertyName LIKE '%$searchKey%' OR c.name LIKE '%$searchKey%' OR c.surname LIKE '%$searchKey%')"; What are the '%$searchkey%' and why is there a p. infront of propertyName Quote Link to comment https://forums.phpfreaks.com/topic/187432-what-do-these-line-of-code-do/ Share on other sites More sharing options...
salathe Posted January 6, 2010 Share Posted January 6, 2010 The p probably refers to an aliased table name (FROM mytable p) and the '%$searchKey%' is a mixture of two things: firstly, the value of the $searchKey variable is substituted into the string (if $searchKey is blah then the string is '%blah%'), then that value is used as a parameter for MySQL's LIKE operation. See the LIKE man page. Quote Link to comment https://forums.phpfreaks.com/topic/187432-what-do-these-line-of-code-do/#findComment-989755 Share on other sites More sharing options...
deansaddigh Posted January 6, 2010 Author Share Posted January 6, 2010 Thanks for your help, tis a bit complicated ill have to try and absorb what you mean. Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/187432-what-do-these-line-of-code-do/#findComment-989761 Share on other sites More sharing options...
Maq Posted January 6, 2010 Share Posted January 6, 2010 This relates more so to MySQL than PHP. Moving there. Quote Link to comment https://forums.phpfreaks.com/topic/187432-what-do-these-line-of-code-do/#findComment-989778 Share on other sites More sharing options...
salathe Posted January 6, 2010 Share Posted January 6, 2010 If you'd like a more in-depth (baby steps) explanation, do let us know and someone will be along to help you out. Quote Link to comment https://forums.phpfreaks.com/topic/187432-what-do-these-line-of-code-do/#findComment-989785 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.