anyone good with html, sql, asp type stuff

Currently reading:
anyone good with html, sql, asp type stuff

Joined
Apr 30, 2002
Messages
17,331
Points
2,648
Location
Wrexham
finally got round to doing my uni project, on final page of site :D

but am stuck on one part of it, im doing a user search page, the results will show all the pics that the user has uploaded

i can get it to show the results, as its just calling it from the database, but the file name the pic is saved as just comes up as text, i need it to be a clickable link so the pic can be viewed when opened

im guessing i may need image tags so it displays the image instead of the filename - i dont really ant to do it this way though, i just want a clicky link - i been told something about anchor tags :confused:

so far the code looks like this -

<HTML>
<HEAD>
<TITLE>User Gallery Search</TITLE>
</HEAD>
<BODY>
<H1>Results from your search</H1>
<!--#include file= "Lib/ASPLib.asp"-->
<%
SET myConn = SERVER.CreateObject("adodb.connection")
DBpath = SERVER.MapPath("db")
strConn = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE="
strConn = strConn & DBpath
strConn = strConn & "\cars.mdb;"
myConn.Open (strConn)
SQLStr="SELECT [User Name], [File Name], [Description] from Files WHERE "
SQLStr=SQLStr & " [User Name]='" & request("dname") & "'"

' see the string generated
'response.write ("'" & SQLStr &"'")
CALL query2table(SQLStr,myConn)
myConn.Close
%>
</BODY>
</HTML>

any pointers in the right direction will be appreciated :)
 
I dont know ASP too well, but in PHP all i do is save the image path as a variable, then use that variable in the image tag- but you have to break the string to use it.

For example (again in PHP but should relate)
$imageURL = /*Your code to get the URL here*/;
$image = "<img src=\"".$imageURL."\" border=0>";
print $image;

OR this may work (shortened)

$imageURL = /*Your code to get the URL here*/;
<img src="$imageURL" border=0>

That should then print out the image. To then develop that into a link, you just need to encapsulate that with the <A></A> tags... If you just wanted a text link, remove the IMG tags from the middle of the link, or change the IMG url to a thumbnail..

Using my 1st example...
$imageURL = /*Your code to get the URL here*/;
$image = "<a href=\"".$imageURL."\"><img src=\"".$imageURL."\" border=0></a>";
print $image;

Oh, and if anyone does know PHP well, dont pick on my syntax is its not 100% - i've got my java brain on ;) :D
 
Last edited:
im writing the code out - aint clued up on dreamweaver

crap it come out small :mad: - columns are USERNAME - FILENAME - DESCRIPTION, the filename just comes up as text, i would like it to come up as a clicky link if poss

usergallery.bmp
 
gaz_wrexham said:
im writing the code out - aint clued up on dreamweaver

crap it come out small :mad: - columns are USERNAME - FILENAME - DESCRIPTION, the filename just comes up as text, i would like it to come up as a clicky link if poss

usergallery.bmp

Right, where you are using the loop to loop through the results, in the filename field, just put the HTML code in the table field around your image url variable...

If you do a complete code listing of that page i'll show you where to put it...
 
i have just found out the files arent saving to anywhere but still get displayed :confused: - the only thing that gets saved to the database is the filename, filesize and file type
 
luke1985 said:
Right, where you are using the loop to loop through the results, in the filename field, just put the HTML code in the table field around your image url variable...

If you do a complete code listing of that page i'll show you where to put it...

the complete code is in my first post - i have a libary file that makes all my tables
 
gaz_wrexham said:
i have just found out the files arent saving to anywhere but still get displayed :confused: - the only thing that gets saved to the database is the filename, filesize and file type

Correct, if you are using an upload tag thingymijig, it puts the file in to the stated directory, or in the same directory as the upload script by Default. It wont save the file in the database
 
ok cheers, am off to go and camp out the lecturers office and wait his return

i didnt want to pick asp honest, i thought making my own site would be easy.......how wrong was i :eek:
 
gaz_wrexham said:
ok cheers, am off to go and camp out the lecturers office and wait his return

i didnt want to pick asp honest, i thought making my own site would be easy.......how wrong was i :eek:

Should have picked PHP like i suggested ;) Would have taken about 20 minutes to complete the whole upload and control scripts :)

How comes you picked ASP in the end then?
 
errm cause i wasted about £100 on asp books :( - none of which have been very useful, although i did manage to create my register page with one

i had already submitted a project proposal and spec saying i was gonna use asp, my lecturer also said "look on my site and borrow the code, im the one whos gonna be marking it", it was an offer i couldnt refuse :D
 
gaz_wrexham said:
errm cause i wasted about £100 on asp books :( - none of which have been very useful, although i did manage to create my register page with one

i had already submitted a project proposal and spec saying i was gonna use asp, my lecturer also said "look on my site and borrow the code, im the one whos gonna be marking it", it was an offer i couldnt refuse :D

Fair enough :) Ive never got on with ASP. took 1 look at it and went straight to PHP. Well goodluck finishing it (y)
 
Blimey. That was just like being at work.

Gaz - you're not the only one who struggles with asp. I can't get to grips
with it at all. I've had to learn hard coding of html from scratch in the 9
months I've been here !!!! Major headache but good when it all works ! :)

Good luck with the project !
 
thanks :D

i have managed to partially learn and 'borrow' code in the 3 months that i been doing it

major headache but hopefully it be worth it, although site will never go live :(
 
woohoo, got my last problem sorted :D

now moving onto the next one :( - its slightly easier though :p

its displaying all the info but its all jumbled, i need to make a table for it to go in, but i keep getting error messages :(

heres the code i need to put in the table

SET rs = myConn.execute(SQLStr)
DO WHILE NOT rs.EOF

response.write(rs("File Name"))
response.write "<a href=""file.asp?ID=" & rs("ID") & """>"
response.write(rs("Description"))
response.write(rs("Content Type"))
rs.moveNext

LOOP
rs.Close
Set rs = Nothing


i have put table tags in it but it just displays a border line, i been told i need <tr> <td> but i dont know where

Help please :D
 
<TR></TR> at the beginning of each row...
<TD></TD> at the end of each item...

So you got the table tag before the loop - <table>
Then at the beginning of the loop have a <TR>
Then a <TD></TD> around each data item, then end with <TR>
Then at the end outside the loop, your </table>

So at a guess...
response.write "<TR>"
response.write "<TD>" & rs("File Name") & "</TD>"
response.write "<TD><a href=""file.asp?ID=" & rs("ID") & """></TD>"
response.write "<TD>" & rs("Description") & "</TD>"
response.write "<TD>" & rs("Content Type") & "</TD>"
response.write "</TR>"
rs.moveNext
 
Back
Top