|
| |
|
|
washurjosh
Posts: 66 Joined: 1/18/2006 Status: offline
|
if then image display result help - 2/18/2006 3:29:50
I have a calendar page where i have a Database Results in each day in the table. I am trying to display an image (i have the url saved in a database field) only if the certain day of the month is between two dates i have saved in fields in my database. out of technical terms: i run a theatre website which i have a calendar which i want to display images of the play if it is between the opening night and the closing night on the day of the week its playing. this is what i have come up with for doing the "If after opening date then if before ending date response.write("url from databse that is displayed as image") <%if Fp_field(fp_rs,"T2") <= "3/28/2006" then if Fp_field(fp_rs,"T3") >= "3/28/2006" then document.write("<img src="FP_Field(fp_rs,"showpicture")" width=""57"" height=""55"">")%> i cant figure out what i am doing wrong.
|
|
|
|
washurjosh
Posts: 66 Joined: 1/18/2006 Status: offline
|
RE: if then image display result help - 2/18/2006 3:33:22
i used this and it got me without and error but no picture displayed <%if Fp_field(fp_rs,"T2") <= "3/28/2006" then if Fp_field(fp_rs,"T3") >= "3/28/2006" then response.write("<img src=""FP_Field(fp_rs,""showpicture"")"" width=""57"" height=""55"">")%>
|
|
|
|
washurjosh
Posts: 66 Joined: 1/18/2006 Status: offline
|
RE: if then image display result help - 2/18/2006 3:54:22
that gave an error so i took out one pair of the quotations around the image source. now it shows a broken image (progress!) although this happens no matter if i change the date or not. confused. thanks so much for your help....
|
|
|
|
washurjosh
Posts: 66 Joined: 1/18/2006 Status: offline
|
RE: if then image display result help - 2/18/2006 4:06:18
would it be easier to do the restrictions in the sql?
|
|
|
|
washurjosh
Posts: 66 Joined: 1/18/2006 Status: offline
|
RE: if then image display result help - 2/18/2006 4:17:17
i solved the issue. Rather than restricting the image display in the asp i did it in the sql which ended up looking like this SELECT * FROM Results WHERE (T5 LIKE '%::T5::%') AND T2 < 3/28/2006 AND T3 > 3/28/2006
|
|
|
|
washurjosh
Posts: 66 Joined: 1/18/2006 Status: offline
|
RE: if then image display result help - 2/18/2006 7:01:46
OK so it didnt work. i realize now i just need help figuring out how to write a sql statement that restricts results in two ways 1) checks that one of my fields "T5" contains a certain word value 2) a certain date (that is unique and will be entered like 2/12/2006 in sql itself) is between two values (dates) in two fields "T1" and "T2" i tried: Select * from Results Where #2/12/2006# Between T1 and T2 it showed results but not the correct results. I also tried it without the number signs to no avail! Please help.....my insomnia is growing worse and worse every day with this stuff :(
|
|
|
|
BeTheBall
Posts: 6381 Joined: 6/21/2002 From: West Point Utah USA Status: online
|
RE: if then image display result help - 2/18/2006 10:58:24
T2 and T are date data types in the db? You are using Access as your database?
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
washurjosh
Posts: 66 Joined: 1/18/2006 Status: offline
|
RE: if then image display result help - 2/18/2006 16:11:47
yeah its access 2000 as far as i know, but the fields are text fields as far as i know also. I dont own MS Access just frontpage 2003 and i dont know how to change the field format without having access. is there a sql that changes it?
|
|
|
|
BeTheBall
Posts: 6381 Joined: 6/21/2002 From: West Point Utah USA Status: online
|
RE: if then image display result help - 2/18/2006 16:30:16
Also may want to try using the Cdate function. Something like: Select * from Results Where #2/12/2006# Between Cdate(T1) and Cdate(T2)
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
washurjosh
Posts: 66 Joined: 1/18/2006 Status: offline
|
RE: if then image display result help - 2/18/2006 16:38:59
ok so that WORKED, but it shows me the plays that are running now. So all the results that are between those dates. However, i have an additional task. I am entering these into a table calendar and need to only see the shows that are on a "tuesday" or "wednesday" or whatever. i have entered this data into a field "T5" which checkboxes for each date. so the field data would be comma deliminated like so: tuesday, wednesday, saturday, sunday or something. so i need to find if that results contains the word "tuesday" or not. something like (T5 LIKE '%::tuesday::%') ??? i know im being picky...i really need to take a class or something. lol
|
|
|
|
washurjosh
Posts: 66 Joined: 1/18/2006 Status: offline
|
RE: if then image display result help - 2/18/2006 17:27:18
Ok, so that worked out fine, it does what it needs to now. however im having a problem with my database field "T5" that has the checkboxes for each day of the week. Well, i have this update form with those checkboxes and they come up checked if the word is in there and so on, however if i uncheck one and then submit it to a DRW that i have on another page to update the data, it doesnt do it. and then i created a text box to show me what is in the field, and it shows something like this , , , , tuesday, wednesday, thursday, sunday, tuesday, thursday, wednesday, sunday, sunday, tuesday and im all confused. How do i get the update to delete all of whats in the field already and just submit what i have checked. i thought thats what update meant? or is there a better way?
|
|
|
|
washurjosh
Posts: 66 Joined: 1/18/2006 Status: offline
|
RE: if then image display result help - 2/18/2006 17:31:41
it seems to be adding whatever i enter into that field (or mark the checkboxes) onto the front of the comma deliminated string rather than replacing what exsisted with the new data. never heard of this. any help?? thanks guys for everything. you guys are great!
|
|
|
|
BeTheBall
Posts: 6381 Joined: 6/21/2002 From: West Point Utah USA Status: online
|
RE: if then image display result help - 2/18/2006 17:59:01
What does your update statement look like?
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
washurjosh
Posts: 66 Joined: 1/18/2006 Status: offline
|
RE: if then image display result help - 2/18/2006 18:00:23
UPDATE results SET theatre='::theatre::', showtitle='::showtitle::', opendate='::opendate::', closedate='::closedate::', T1='::T1::', T2='::T2::', synopsis='::synopsis::', showpicture='::showpicture::', boxofficenumber='::boxofficenumber::', T3='::T3::', T4='::T4::', T5='::T5::' Where ID=::ID::
|
|
|
|
washurjosh
Posts: 66 Joined: 1/18/2006 Status: offline
|
RE: if then image display result help - 2/18/2006 18:14:36
wow. genius! i totally forgot i made hidden ones thanks guys!! hopefull this is the end of this thread. ha :)
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|