![]() |
Repeating the same query
I am doing a query where the choices are title=$extra1 or title=$extra2 or title=$extra3 (up to 6 extras)
I am getting the same result for all, and I ended up doing the below 6 times. Surely there must be another way to do this to avoid the 6 queries? PHP Code:
|
PHP Code:
|
Can't you do a:
Quote:
|
Quote:
This is a non Vb script where I cannot do a normal eval for a templatebit. when I do: PHP Code:
$extra1 only the first one is returned. The others have no results. Quote:
|
I dont seem to understand your problem :)
Please post a scheme of your Table with example Data, the values for extra1, extra2, etc. and what you would like to have returned. But I think your problem does have nothing to do with the query: PHP Code:
|
OK, here is what I am doing:
When I input the data in that page I have $desc which I am using to parse Geek autolink to lyrics. I have 6 extra fields that I could use. I am using them to query a database of MP3s. I put the exact title in the various extra fields. Then I do a query in the php. If the soundtracks title matches one of the extras, then I need to get the info for each one of the extras (I have embeded a player in the page and when you click on the link at the bottom of the page, it plays the selected clip). My method works, but I have to do the same query six times. |
The linked page is in french and I understand nothing :)
Please, just post your table scheme, example data, the extraX values and which rows you want to have selected for those. |
Oh well, sorry for the French.
I am no guru. What you saw is from painfully put together hours of trial and error spaghetti codes. I don't even know what you mean by schema. |
Quote:
|
This is the scheme of Table datastore:
Code:
CREATE TABLE `datastore` ( Code:
INSERT INTO `datastore` VALUES ('cron', '1122540900'); |
Quote:
|
1 Attachment(s)
ok thanks. I am putting only a few, because I have hundreds of data
PHP Code:
PHP Code:
how I am displaying it now: Quote:
Thanks. |
OK. Now if you could also post example Values for extra1, etc. and what should be the output then, I might be able to help you ;)
|
Values for extras are exactly the same as in title.
we put in a different song title in each one of the 6 extras textboxes. Then we query db. If title matches any extra, then we grab the info for that title. |
Please read post #5 again (mind that '=' is changed to '.='), i think that is your solution.
|
Quote:
|
= is an assignment, .= is a concatenation
$foo = 'bar'; $foo = 'bar'; results is $foo being 'bar'; $foo = 'bar' $foo .= 'bar' results in $foo being 'barbar' |
Got it. Thanks. Not bad after 6 hours for just one dot :-)
|
Hmm ... lol.
SCNR ;) |
Examples:
PHP Code:
Code:
line2 2nd example: PHP Code:
Code:
line1 |
Now that's English! Nothing like the php website where they assumed that you were born a programmer.
|
Got a tiny problem: Apostrophe
Quote:
thanks. ok, never mind. Instead of a single quote, I put double quotes, escaping them. \" |
All times are GMT. The time now is 04:29 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:
|