![]() |
Comparing post titles with a variable
Hello all,
I was wondering if someone out there can help me out with some sql code. I am wanting to create a query that will search all the posts in the post table and compare the titles to a variable (say $formtitle). If it finds a match it will return the threadid of the matching title; thier can only be one matching title in the post so the limit should be one. I have this so far but it is not working Code:
$formtitle= "$answer1 $answer2) |
do you want the title to be EXACTLY the string you are searching for or not?
also: $formtitle= "$answer1 $answer2) should be: $formtitle= "$answer1 $answer2"; |
Yes I would like the title to match character for character.
opps. the $forumtitle should read the way you corrected it, I guess I was typing too fast. ;) thanks |
hrmm.... try this:
SELECT * FROM post WHERE post.title LIKE '$formtitle' LIMIT 1 |
Use LIKE '%$formtitle%' if you want to match the pattern of that string in any occurence of any other string. E.g. Dan would match Danni :)
|
both solutions did not work :( any other suggestions guys
|
Odd, previous solutions provided should work.
ie. PHP Code:
$output should return the result ( threadid ) if there is such a match. |
All times are GMT. The time now is 10:24 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|