PDA

View Full Version : In need of some mysql help


Elem
01 Jul 2003, 02:41
I could really use some help on this problem i can't get around....and with my limited knowledge of mysql this is causing some problems

Ok i guess i should start off with what i'm trying to do. I have made a file uploader. Now what i want to do is when the user ventures to the upload area it shows them a link for each uploaded file. Also i should mention the script is being run from within vb...so it is using vb's db.

Here's what i currently have


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



uploadname is a column i have added to the users table. Upload_none template says there are no pics...and the Upload_isthere template is supposed to show the links

once an image is uploaded this is the query i'm using


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


$imname is $_FILES['userfile']['name']

Upload_isthere looks like this


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



As it is right now...it only shows the file that was last uploaded...nothing more..even though there are 2 images in the db

So my question is how do i get it to display all of the images uploaded?

Also how do i get it so it only shows the pics uploaded by that person only?

I really appreciate any help...since this is my first hack from scratch and i'm really lost :P

Cloudrunner
01 Jul 2003, 03:23
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Hope that helps, follow the comments and you should see the steps.

Elem
01 Jul 2003, 03:55
hey thanks for your help...although it's not quite fully working yet

now on the page is it just showing the url once...without the filename attached.

this is the current upload_ishere


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



this is the template which is the index for the hack...i apologize for it being long but it is the full thing incase there is an issue with it



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



thanks for all your help

Cloudrunner
01 Jul 2003, 05:46
upload_ishere:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


unless of course $shorturl is defined in the script elsewhere it would be best to use $bburl/path/$picname...

upload_index:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Do a side by side file compare using beyond compare2 (or equivalent) and you'll see where I made the changes...Basically the reason your link would show only once is that you had two table rows defined one after another...no good...also, make sure that the userid is the same in both items....

Now, one thing, if you are using the user table to define the upload pics, then you would be better off using the uploadname field as an id to query off another table that has the filename stored...that way each user can have multiple uploads. The way it is setup now will only allow one upload per user. The reason is that each user only uses one row in the table, thus only allowing one piece of data per field. Thus, the new query that I provided you will only show one field.

If you want, we can hook up this weekend via any of the messengers listed in my profile and we can walk through the code abit and see what we can do with it...but for now without more background on the hack, I canna help any more than what I have done here.