mySQL substring & instr problem
Anyone able to have at look at this? still un-resolved and am desperate to get this working, I am confident I know how the code is working, it is just a problem with the WHERE clause.
I need it so that the var $pageGrandChild matches the last part of a string in the database i.e. foo-bar-rules. Any ideas?
$pageGrandChild = PAGEGRANDCHILD;
$rangeRelationResult = mysql_query("SELECT DISTINCT SUBSTRING(slug, 1, INSTR(slug, '-') - 1) result
                                    FROM web_navbar_links
                                    WHERE SUBSTRING(slug FROM INSTR(slug, '".PAGECHILD."') + 2) = '$pageGrandChild'
                                    AND grandchild = 1
                                    AND slug != '".PAGEPAR开发者_C百科ENT."-".PAGECHILD."-".PAGEGRANDCHILD."'
                                   ");
Thank you for reading and sorry I have posted this twice.
<?php mysql_query('...WHERE foo-bar-rules LIKE "%'.$pageGrandChild.'"...'); ?>
?
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论