Random Image And Text Display
On my index page I have got an area for one product to be displayed randomly from the
database. I have got it workign, but there is one problem i cant get my head around, here is the code so far:
' Initialize ASP RND() function
Randomize()
intRandomNumber = Int (1000*Rnd)+1
strsql = "SELECT TOP 1 art_Artist, art_Title, Rnd(" & -1 * (intRandomNumber) & "*cat_ID)" &_
"FROM eventDisplay " &_
"ORDER BY 3"
The code above isnt working and its when i try and draw out more that one value, as in art_Artist and art_Title.
It works fine if all I want is art_Artist, but as i said when i try to draw out more than one value the randomize function doesnt work.
View Replies
ADVERTISEMENT
I want to provide random image on my asp page. the image will display according to products searched by user.
e.g.
if user enter pharma machine in search box, in result page the banner of pharma company will display. i.e. the banner of manufaturer/exporter of pharma machine will display.
for this i have comapny info table in database
table: comapny_info
fields in comapny_info:
company_name
products (comapny products)
description (company_description)
banner (yes/no)
dusring registration, comapny has to specify whether it wants banner or not. so if there is yes in banner and prodcuts match the search string then banner will display.
this is according to the product seaarched by user.
any idea?
View Replies
View Related
i want to display images in my search result page according to search text enetered by user. and i want more than one images display randomly.
View Replies
View Related
I am trying to display records ( text and images) from a database. I get the text displayed but the image is displayed as a large series of Asscii text.
Connect.open "DSN=Rentals"
'declare sql statement that will query the database
query = "Select * FROM RentalTable WHERE Location LIKE '%"
query = query & Replace(request("varLocation"), "'", "''") & "%'"
query = query & " AND PropertyType = '" & Replace(request("varPropertyType"), "'", "''")
query = query & "' ORDER BY DateAvailable"
RS.Open query, Connect
do until RS.EOF
%>
<table width="75%" border="1">
<tr>
<td><%=RS("Address")%></td>
<td><%=RS("Location")%></td>
<td <%
Response.ContentType = "image/gif"
Response.BinaryWrite(rs("Image1")) %>
</td>
</tr>
</table>........
View Replies
View Related
I have a client who has had a ASP site with an Access database for several years. It stores information for the used cars on his lot. I have stored text in the database that points to the location of the image for each record. Each record will have a thumb image that is supposed to display in a list of vehicles available then the user can select an item from this list and a new page displays with the information and the regular size image. So far everything has worked fine exept for the display of the images which are stored in a separate directory called veh-photos. All I get are image place holders. I am using Dreamweaver 2004 and and Access 2000 for the database.
Following is the code to list vehicles: ....
View Replies
View Related
I have done random image display with the help suggestion from this discussion form. now I want to provide link on each image. i.e. all the images display randomly, should have different link. is it possible? if yes, how?
View Replies
View Related
example:
When u see some sites ,
the advetisement images are changing ,
when ever the browser is refreshed...
.....
like tha i want to do that.....
View Replies
View Related
I have the below ASP function to display a random image from a folder.
<%
Function RandomImage(strPath)
Randomize()
If Right(strPath, 1) <> Chr(47) Then strPath = strPath & Chr(47)
strPhysical = Server.MapPath(strPath)
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:Inetpubwwwrootpag-siteimages
andoms")
Set objFiles = objFolder.Files
For Each objFile in objFiles
strFile = LCase(objFile.Name)
strFiles = strFiles & strFile & vbTab
Next
strImages = Split(strFiles, vbTab)
If UBound(strImages) > 1 Then
RandomImage = strPath & strImages(Int(Rnd(1)*UBound(strImages)))
End If
End Function
%>
and this places the image in the HTML
<img name="Intropic" src="<%=RandomImage("images/randoms/")%>" width="211" height="158" alt="" />
but sometimes the script places a ._ before the image file name in the outputted HTML?
View Replies
View Related
If I want a webpage to display a random image from about 20 images and not want the user's computer to load all 20 images and sacrafise the load time, can I use the following script? Is the following a good approach? Code:
<%
Const NUMBER_OF_IMAGES = 20
Randomize
Dim intImageNumber
intImageNumber = Int((NUMBER_OF_IMAGES * Rnd) + 1)
%>
<html><body>
<img
src= "images/header<%= intImageNumber %>.jpg"
width = "760"
height = "104"
>
</body></html>
View Replies
View Related
I am doing a simple program which display random records to students.The student table has the following fields(Access Database) Code:
1.Studentid-Number
2.Studentname-Text
3.Class-Text
4.Ans-Text
and Question table as
1.Questionid-Number
2.Questions-Text
Now What i am trying to do is , when the first time is student is login,he wil be shown a random record from the question and his answered wil be stored in the Ans field of the student table with column separeated.
The he will be redirected to the same page with one new question.This question should not be in the Ans Field, and must be randomly generated.I am using this code.But this not working. Code:
View Replies
View Related
I am trying to retrieve images from the database and display them in a random order. The order of the images is supposed to change each time page is refreshed. Below is my code, I am using an array to store the images but the images are not displayed for some reason. Code:
View Replies
View Related
I have this code that displays record sets at random, but some of time the results are less than the minimum set, which is 5 records. It is less, or none at all. What I need is for the asp to display records randomly on each submit.
Currently, the asp runs so that the whole recordset is different, i.e. Random. I am a little concerned about the load on the server by running such a script....perhaps someone can clarify.
'Set the number of records to display on each page by the constant set at the top of the script Code:
View Replies
View Related
i have some code that displays a random image... and i have some code that refreshes a page ever x seconds. great.
what i want to do is, have sort of like a banner rotating system... not links, just displaying random images every x seconds on a portion of my website... im sure someone has done this before, but im not sure how to go on from here.
View Replies
View Related
I have a client that has a guestbook and they have been getting slammed with spam...
Would like it if someone could post a script to create one of those "input the letters you see here" scripts to prevent the spam bots from being able to post automatically....
View Replies
View Related
I am currently looking for a script similar to A List Apart Article Random Image Rotation. Unfortunately my clients host does not support PHP. I want to randomly rotate 3 images in the header section each time the page loads.
As it's only 3 images, I could turn to javascript, but then I would need to include that in every page. The header part of the site is an #include file, so I was thinking I wanted to do something like this.. Code:
View Replies
View Related
I was wondering if anyone knows how I can have a random product image shown on a page with information such as product info, price from the db?
View Replies
View Related
I’m having problems on how to randomiz numbers and delete the ones that have been displayed.
My first step is to take some numbers:
21, 32, 35, 4, 15 and randomize theese so the ouput may look something like this:
35, 21, 15, 32, 4
My second step is to display the first number (35), then when a user clicks on a link I want the second of my random number (21) to be displayed and I also want to delete the first number (35) that has been displayed. And this routine (display number, delete previous number) should continoue untill there is no more numbers. So again, I wnat to step through all my random numbers and delete the ones I have displayed.
Example: ....
View Replies
View Related
I have y pic's on the server and each time someone visits the site I want to display x of them randomly.
View Replies
View Related
I am trying to get random, unique pics to display but for some reason, I sometimes get the same pics showing twice.
could someone kindly shed some light on this Code: ...
View Replies
View Related
I Have searched the forum but have no solution to this problem.
I want to display my records in a random order. I loop through my records so I don't know how many records will be displayed. I dont want to count the records and then use the TOP statement. I'm looking for a better solution.
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open SELECT test FROM testTable WHERE testId = 1, objConn
Do While Not rs.EOF
Response.Write "<b>" & rs("test") & "</b>" <- I want theese records to be displayed in random order
rs.MoveNext
Loop
Anyone has a solution to this problem?
View Replies
View Related
How bout I go about creating a section on my site that displays a random image, lets say:
1) every time the page is refreshed
2) in a certain amount of mins or hrs the pic changes
3) daily, monthly and so on?
Would I need a database of some sort or can it just be done with some asp code?
View Replies
View Related
I am trying to retrieve images from the database and display them in a random order. The order of the images is supposed to change each time page is refreshed.
Below is my code, I am using an array to store the images but the images are not displayed for some reason. Any help would be appreciated.
<% Dim rstResult
Dim strSQL
Dim img(100)
imgID = 0
set rstResult = Server.CreateObject("ADODB.Recordset")
strSQL = "sp_sel_TilesByType 'O'"
rstResult.Open strSQL, strConnect
set rResult = Server.CreateObject("ADODB.Recordset")
sSQL = "sp_sel_TilesByType 'O'"
rResult.Open sSQL, strConnect
if not rResult.EOF then
do while not rResult.EOF
response.write("hi")
imgID = imgID + 1
img(imgID) = "images/tiles/" & rResult("TileImage")
response.write(img(imgID))
rResult.movenext
loop
end if
if not rstResult.EOF then
intVendorID = 0
do while not rstResult.EOF
if intVendorID <> rstResult("VendorID") then
rndNumber = RandomNumber(imgID)
Response.Write "<p>"
Response.Write "<a href=javascript:popWin('tileview.asp?" & rstResult("TileID") & "','',1,1,1,1,700,600);>"
'Response.Write "<img src=images/tiles/" & rstResult("TileImage") & " border=0>"
response.write(rndnumber)
Response.write "<img src=img(rndNumber)>"
Response.Write "</a>"
Response.Write "</p>"
end if
intVendorID = rstResult("VendorID")
rstResult.MoveNext
loop
end if
set rstResult = nothing%>
View Replies
View Related
I have a database with 20 companies and their links in it. Ive tried to develop some code that i found in another forum while i was searching for a solution to 'unique random links' but, although i feel im close, Code:
View Replies
View Related
This Random image script gets an image out of a folder so NO database is needed, just create a subfolder for your images and upload to your server ...
View Replies
View Related
I have a script which show quotes randomly, Here is the code::
Code:
<%
Dim quotes(3), iNumber, iRandom
'Dim an array of 3 variables
quotes(1) = "This is quote 1"
quotes(2) = "This is quote 2"
quotes(3) = "This is quote 3"
iRandom = ubound(quotes)
randomize 'call random function
iNumber = Int((iRandom)* Rnd) 'get random quote number
Response.Write(Quotes(iNumber)) 'write output to screen
%>
How can i do a thing like:: (for example)
Show the Quote(1) on 10th September 2004
Show the Quote(2) on 11th Sep 2004
Show the Quote(3) on 12th sep 2004
Is that possible?
View Replies
View Related
This worked fine for enlarging my images until i put it onto a secure server, anyone know how i can fix it ??? just comes up with the standard box with a red cross in it .. and the url when i click image properties says: http://url/images/<%=request.querystring( which is only part of the code)
View Replies
View Related
I have some error in displaying Image in the fields here is the Code:
<tr class="productListing-<%=even%>">
<td class="productListing-data"> <img src=""" & <%=rsProducts("product_image")%> & """ width=""20"" height=""20""/><br /></td>
<td class="productListing-data"> <a href="?mod=product&cat_id=<%=cat_id%>&product_id=<%=rsProducts("product_id")%>"><%=rsProducts("product_name")%></a></td>
<td class="productListing-data"> <%=rsProducts("manufacturer_name")%></td>
<td class="productListing-data"> <%=strCurrency%> <%=RoundNumber(rsProducts("product_price"))%></td>
</tr>
Where is the error ....
View Replies
View Related
I've been creating a page in asp which displays records from an access database. I have limited the number of records displayed to 5 per page. If there are more than 5 records then the user can click next to view the next 5 and so on.
My Image field in the database has a data type of "text" and then i put the path to the image. However when i run my asp page it displays the path as text and im not so sure were im going wrong.
Here is a section of the code used to display the recordset.
For intRec=1 To rs.PageSize
If Not rs.EOF Then
Response.Write "<tr>"
For Each fldF in rs.Fields
Response.Write "<td>" & fldF.Value & "</td>"
Next
Response.Write "<tr>"
rs.MoveNext
End If
Next
Response.Write "</tbody></table><p>"
View Replies
View Related
I have asp pages running from a MySQL database.
I have placed a path in the required field (although not quite sure on
the correct format).
My asp page is just displaying the text path instead of the image.
I'm using response.write.
The Folder is called : images
This folder is within : wwwrootworksimagesimage1.jpg
How should I display this in the MySQL field ?
I have the field as type: VarChar
How do I display image1.jpg on my asp page ?
View Replies
View Related
I've been trying to find information on displaying images from an Access database, however, the information that I've discovered does not clearly define the steps necessary to display the image with text. Can anyone provide a good reference or explain it to me (like a five-year-old) the complete steps to display an image from an Access database using ASP?
View Replies
View Related
I'm trying to display an image which is stored in a database, followed by some other information, but I'm having some issues. It's stored in an access database as an OLE object. The code I've got right now is:
<%
Response.ContentType = "image/gif"
%>
<img src="<%= Response.BinaryWrite(rs("ItemImage")) %>">
The error message I get displayed "The image cannot be displayed because it contains errors"
I also tried it like this:
<%
Response.ContentType = "image/gif"
%>
<img src="<%= rs("ItemImage") %>">
which didn't display any errors, but also didn't display the image.
Any ideas where I'm going wrong with this?
View Replies
View Related
I have an image database, I want my images to be displayed like google when you try to search an image - displays horizontally.
How would I check if the first row already has, say 5 images, and then add another row for the next set of images and so on?
can someone show me a tutorial, an article for this one?
mine doesnt require to search for any images, just concerned with the display.
View Replies
View Related
I need to be able to display an image if the time is between two times. Here's the code I have, but it doesn't work.
dim strLink1, strLink2, strLink3
dim tcurrent, tstart1, tend1, tstart2, tend2
tcurrent = now()
tstart1 = "3/1/2006 7:00:00 PM"
tend1 = "3/1/2006 8:00:00 PM"
If Now() >= tstart1 OR Now() <= tend1 Then
'if tcurrent > tstart1 or tcurrent < tend1 then
strLink1 = "/images/2.jpg"
else
strLink1 = "/images/1.jpg"
end if
When I look at the page, the image never changes. It just always displays 2.jpg and not 1.jpg. I need help ASAP!
View Replies
View Related