Jump to content

Problem with connection database


Lize

Recommended Posts

Hi,

 

For school, I need to build a site and this site has to have a few applications. One of the applications, I have to make is to make a script that makes it possible to upload a file and it has to put this file in a online database. Now, I'm just trying to put it in a local database. My code doesn't give an error, but it doesn't work either. The file doesn't get into the database. I can't figure out why. I hope you can help me?

 

Thanks in advance!

 

Lize

18014_.php

18015_.php

Link to comment
Share on other sites

What does "doesn't work" mean? Blank page? You get the failure message? Okay so it doesn't do what you want, but what does it do?

 

Also, you're overwriting the $uniekpatient with the uploaded file. First you put the $inhoud stuff in there but then you move the uploaded file there as well.

(Unless you actually have to,) you don't need to put $inhoud in a file. All that information is being stored in the database so you can look it up anytime you want.

 

Another possible problem could be with permissions. You're putting the files in the same directory as this .php script (which is a bad idea - put them in a dedicated directory like uploads/ or something). On Linux-/Unix-based systems you need to have write permission on that directory. Try chmodding it to 0777.

Link to comment
Share on other sites

When I upload the file, it has to be put directly in the database. But he doesn't do this. He says: "Er is iets foutgelopen bij het versturen, probeer later opnieuw." what I have wrote in my script. So there isn't an error, I think there is something wrong between line 30 and 54 but I don't know what. I have made a table in my database, and the columns are the same as in my code, I've checked it already 20 times.

What it does: he puts my file into the map where my files with the code are in, in my workbench. That also not what I want (I will solve this later), but more important now, is that I can put it in my database.

 

$inhoud is used to show to person who uses the application what she/he has upload en with what name it is stored in the database.

The purpose of $uniekpatient is to make the name of the file unique. I have to do this, because the site we are building, it for dokters. They have to can upload the results of their patients, so we think there wil be more then one a day. It's a precaution for not having files with the same name.

 

The system I'm working in, is not Linux, I'm using Windows.

 

Maybe good to know, I already made another page (also to upload a file, but another one and it also has te be put in the same database but in another table) and that page does work. When I upload that file (it's more or less the same as the file I want to upload now) he shows my "De referentiefile is succesvol verstuurd" and if I check it in the table, it's true, the file is stored in the table. The code that I used, is more or less the same as this code, so that's also why I don't get it's wrong.

 

Thanks for your answer!

18039_.php

18040_.php

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.