Hi there i have a tree structure navigation for a web site i am building, each page has an id, a parent_id and name. i am looking for a way given one name that i can get the tree to the root page.
a simple excample will help me explane better.
page table
id | parent_id | name
1...
Hi I am taking over a simple website database that has pages. Each page has a parent_id.
I have just looked at the database table and it has thousands of entrys. I looked into it a little and basically when a page was being deleted its children were not getting deleted.
I would like to clean...
Hi I would like to get the next and previous records when i am ordering alphabetically.
So i have the following
id name
1 john
2 simon
3 luke
I am on the record luke and i want to get the next one and the previous one in alphabetical order. So my sql query would give me back...
Hi i am getting a syntax error from this can anyone tell me where i am going wrong. Thanks in advance.
syntax error
var regexS = "[\\?&]"+name+"=([^&#]*)";
PLEASE IGNORE THE ABOVE POST I HAVE NAILED IT
SELECT c.content_general AS headline, c2.content_general AS body
FROM news n
INNER JOIN content_english c ON c.id = n.headline
INNER JOIN content_english c1 ON c1.id = n.body
WHERE n.id =7
Hi i am back again as i have been thinking about the way i do my search and i think it would be better for me to get the content_general entry from this query rather than getting the ids. However this would mean i would have to get entries from more than one row in the content_english table.
So...
I did it like this and thought i should post it here anyway.
SELECT n. *
FROM news n, author a
INNER JOIN content_english c ON c.id IN (n.headline, n.body)
AND (c.content_general LIKE '%test%' OR n.author LIKE '%test%')
AND n.live =1
AND n.author = a.id
I imagine there is a more elegent way of...
Hi How is everyone today?
I have to add another bit onto this query yous helped me with. I now have to check the author is in my author table so
SELECT n. *
FROM news n
INNER JOIN content_english c ON c.id IN (n.headline, n.body)
AND (c.content_general LIKE '%test%' OR n.author LIKE '%test%')...
I would like that to be matched as well.
I have done something like this so far
$noTags = strip_tags($text);
$withEm = str_replace($_GET['sq'], '<em>'.$_GET['sq'].'</em>', $noTags);
print '<p>'.substr($withEm, 0 , 100).'...</p>';
$pos = strrpos($withEm, $_GET['sq']);
if (!($pos === false)){...
Hi I want to format the way I output search results by showing the string query inside <em></em> tags and cut it so shows this in the middle of 20 characters.
So if i have
$text = "this is the test text i have but i dont want to output it all so just want to output the important part of the...
Ok again before i start thanks for the help. I have changed it slightly to deal with another field 'author' that is not in the content table.
SELECT n. *
FROM news n
INNER JOIN content_english c ON c.id
IN (
n.headline, n.body
)
AND c.content_general LIKE '%test%'
AND n.live =1
OR (
n.author...
I changed it to this
SELECT DISTINCT (
n.id
), n . *
FROM news n
INNER JOIN content_english c ON c.id
IN (
n.headline, n.body
)
AND c.content_general LIKE '%Glasgow%'
and it works
This gives back duplicate entrys i.e. it gives back two entrys if the word is in the heading and the body. Plus the live is a boolean value i want to check is one so i dont give a none live article in the search.
cause the headline and body are numeric values that represent rows in the content table. So i have these table.
news table
id | headline | body | live
1 | 1 | 2 | 1
2 | 3 | 4 | 1
Content table
id | content_general
1 | "this is headline for new article id 1"
2 |...
I have just worked it out not really hard i should have tried before that post. Sorry
SELECT n. *
FROM news n
INNER JOIN content_english c ON c.id = n.headline
OR c.id = n.body
WHERE c.content_general LIKE '%Glasgow%'
Cheers that was quick!
How do i add extra fields to it, cause i have to check weather the body field has the word incase the headline does not.
So want to see if this row has the word glasgow in it anywhere in the headline or the body.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.