The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
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) $prevpost = $DB_site->query_first("SELECT * FROM post WHERE post.title='$formtitle' LIMIT 1"); |
#2
|
||||
|
||||
![]()
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"; |
#3
|
|||
|
|||
![]()
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. ![]() |
#4
|
||||
|
||||
![]()
hrmm.... try this:
SELECT * FROM post WHERE post.title LIKE '$formtitle' LIMIT 1 |
#5
|
||||
|
||||
![]()
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
![]() |
#6
|
|||
|
|||
![]()
both solutions did not work
![]() |
#7
|
||||
|
||||
![]()
Odd, previous solutions provided should work.
ie. PHP Code:
$output should return the result ( threadid ) if there is such a match. |
![]() |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|