0

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 != '".PAGEPARENT."-".PAGECHILD."-".PAGEGRANDCHILD."'
                                   ");

Thank you for reading and sorry I have posted this twice.

2
  • 1
    Please don't post duplicates, they are very much frowned upon around here. I'll post a comment in the other question Commented Oct 25, 2010 at 10:01
  • possible duplicate of Slight problem getting mySQL SUBSTRING to work.. Commented Oct 25, 2010 at 10:01

1 Answer 1

1
<?php mysql_query('...WHERE foo-bar-rules LIKE "%'.$pageGrandChild.'"...'); ?>

?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.