Lize Posted April 9, 2012 Share Posted April 9, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/260635-problem-with-connection-database/ Share on other sites More sharing options...
requinix Posted April 9, 2012 Share Posted April 9, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/260635-problem-with-connection-database/#findComment-1335819 Share on other sites More sharing options...
Lize Posted April 10, 2012 Author Share Posted April 10, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/260635-problem-with-connection-database/#findComment-1336008 Share on other sites More sharing options...
Lize Posted April 10, 2012 Author Share Posted April 10, 2012 O M G! I just found what was wrong! I just forgot 4 of these signs: ' . Now, there isn't a problem anymore. So stupid of me. I just looked over it al the times.. I'm sorry for wasting your time. Quote Link to comment https://forums.phpfreaks.com/topic/260635-problem-with-connection-database/#findComment-1336015 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.