dbsreq = "SELECT data_contents, data_style FROM content WHERE data_language = '" & siaith & "' AND data_type = 'title' AND 'slogan';"
(obviously it's all on one line in my code)
I don't understand why it brings up just 'title', not 'title' and 'slogan'?
Any ideas/fizes/suggestion would be greatfully appreciated.
Thanks,
DeianHi ,
You may try to use:
dbsreq = "SELECT ... AND data_type = 'title' AND data_type = 'slogan'";
Regards,|||Actually, you would want something like:
dbsreq = "SELECT ... AND (data_type = 'title' OR data_type = 'slogan')";
Terri|||i've tried everything including changing it to OR, but OR does't work as it brings in wrong data. I think I may need nested statements?|||Make sure you use parentheses to logically separate your conditions when an OR is used.
If you are still having trouble, response.write your dbsreq and let us know what it contains when it is about to be executed.
Terri|||what i've got ok... is a db structure like this:
table content has data_language (has welsh, english or both), data_contents (well the contents, i.e what the user reads), data_style (style to apply to the data), and data_type (type of data, i.e title, slogan, body paragraphs, smallprint, ext.links, int.link etc,etc)
Now what i want to do is (in pure english):
select data_contents and data_style from the content tables where the data_language is (in the first case english and both (i.e both is a value that descirbes neither english nor welsh, but a common word like dotcodotuk in other words it is a made up word that i just put in for fun) and also the data_type which in the first case would be titles and slogans. Now when the page gets regenerated the language will change to welsh hence the variable. And thats all that will change for the title ascx file. So I don't see why an OR statement is needed.
What happens is i bind the data using response.write(span blah blah blah...) It DOES work.
Problem is when i want (titles AND slogan) and (english AND Both) or in the case of the regenerated page (welsh AND both).
I'm planning to have my whole site working on variables to write sql statements based on ascx files that get/set their values from parent page or fellow ascx files. Therefore eliminating pages.
All contents and styles will be DB based.
Thanks for any help. If anyone is on msn (deian9@.hotmail.com), i'll be on-line until about midnight(gmt) to show my site online or swap files/code.
Thanks, this is really bugging me!
Deian|||What you are saying does not make any sense to me.
Think about it.
SELECT * FROM content WHERE data_language = 'English' AND data_language = 'Both'
This statement willnever return any records. That WHERE condition is evaluated for each row independently. You are not going to have any rows where the data_language contains both English and Both.
This statement would be more correct:
SELECT * FROM content WHERE (data_language = 'English' OR data_language = 'Both')
Now, when you combined that with the need to return titles and slogans, again, you would have a statement like this:
SELECT * FROM content WHERE (data_language = 'English' OR data_language = 'Both') AND (data_type = 'titles' OR data_type = 'slogan')
Terri|||yes you are very right there...
how can i get english and both when i can only have one value in a field
so when u lot say i need english or both to return either u are right and i'm wrong, this logic stuff is like one big puzzle to me.
reason i thot u lot was wrong is because i got lots more data than intended, which means i need more filters or sorting.
thanks for pointing that out, again... my apologies for being stupid!
No comments:
Post a Comment