Jump to content

jdavidbakr

Members
  • Posts

    271
  • Joined

  • Last visited

Everything posted by jdavidbakr

  1. In your code sample you're only dividing the file size by 1048576 as you echo it, you're not doing the conversion to the actual variable you're inserting into the database...
  2. $brand needs to be in single quotes $getBrandID = "SELECT brandID FROM brand WHERE brandName = '$brand'";
  3. If you're not familiar with how HTML forms work, you might just start learning about that. What you're wanting to do requires a base knowledge on a number of topics (listed above). The best way to tackle this is to learn each part separately, then you can put it all together. Start by making a page that has a form and echoes the submission back to the user. Then build up from there. The truth of the matter is, in my opinion anyway, using flat files is much more complicated and has a steeper learning curve than using MySQL.
  4. You need to put quotes around $brand but that query looks right. Now just check the result with mysql_fetch_row() perhaps, and see if you got a brand_id; use it if you did, and insert if you didn't.
  5. Currently you're not processing the page at all as you read it. You've got a lot of code to write still.
  6. So the user is manually typing in the brand and you don't want to insert the new brand if it's there already? Before you do the insert into brand, do a select brand_id from brand where brand_name = the new name. If you get a result, use that brand_id for the product insert, otherwise insert into the brand table as you have done. Oh, and don't forget to sanitize your $_POST variables.
  7. I'm not familiar with joomla but my first guess is that either there is a config value in the database that defines the domain, or there is a config file that defines the domain, or possibly both. You need to find where in the code and database in refers to the domain and change it from .info to .com.
  8. Sounds like the phpMyAdmin config value of 'AllowUserDropDatabase' is probably set to false on your server: http://www.page-zone.com/forums/general-questions-comments/124-phpmyadmin.html
  9. jdavidbakr

    Many-to-Many

    Sounds like you've got the tables set up correctly, it's just a matter of joining the tables you need. If you only need the list of documents for one product, you just need a join between the Producto_Documents table and the Documents table where the Producto_Documents table's product id is what you're looking for. If you want a list of products and their related documents, you'll do something with grouping using all three tables. There's lots you can do with those three tables, you just need to identify how you need to join them together to get the result you need.
  10. Have you looked at the MySQL manual for the count() syntax? http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_count
  11. It looks like it's just asking you to create an index on am_startup.employee but if you already have it indexed then I'm not sure why it seems to think it's not. Might double-check to make sure that your index includes only that column, which is specifically what it's asking for. If it is correct then it may be a bug in the framework when it checks the database schema. Someone more familiar with Qcodo may have further insight.
  12. Anyone got any ideas please ? Are you typing in the prompts?
  13. Now we go back to the whole question of whether that code is even running. You have an "if" statement that tests for the existence of $_POST['submit'] that I think is preventing the upload code from doing anything.
  14. Why are you using $_FILES[0] instead of $_FILES['myfile']?
  15. Look at those lines, do you see what it's talking about?
  16. Ok, now you should be ready to remove that code, now that you know that the file is being submitted (the "exit" statement is preventing anything below from executing so that's why it's not doing anything)
  17. Try killing the javascript and see if the form submits ok without it. I'll bet it will. You'll probably need to trace through that code to see what it's doing and why it's not working, but it's somehow converting the file into an input named "undefined" with the file's filename when the form is submitted - and the file is never actually getting submitted. Is this a form submission script that you got from somewhere or did you write it yourself? The reason I ask is that doing the progress bar upload with AJAX is pretty hairy - best to get your form working without the javascript, then try to adapt it to try to get the progress bar.
  18. Wouldn't MVC technically just be a subset of OOP? Isn't OOP nothing more than breaking your code into objects that act independent than one another, while MVC is that but more strictly defined?
  19. I think it'd be tough to pull it off, although I'm sure there could be a clever way to do it. Nothing native to PHP, and I can't readily think of a way to do it that wouldn't be easily circumvented.
  20. The "undefined" field in the post also is very odd. There is not any javascript processing on the client side for the form submission, is there?
  21. So when you posted to the file that only printed out the $_FILES array what did you get? Just a blank page? At the very top, before your opening "<?", put this block: <? echo "Post Data:<br>"; print_r($_POST); echo "File Data:</br>"; print_r($_FILES); exit; ?> You've got so many print_r's in that code, and what's being printed appears to be the $_POST variable and not the $_FILES variable, so use that - which will stop and not execute any of the code afterward - to see what exactly is ending up at the server.
  22. Hm, I'm at a loss. I've copied your form code into an html page on my server, then posted it to a php file with just this: <? print_r($_FILES); exit; ?> and got this result: Array ( [myfile] => Array ( [name] => test.txt [type] => text/plain [tmp_name] => /tmp/phpk2krLk [error] => 0 => 301 ) ) Try putting that block of code at the top of flash_upload.php just to make sure that something in the rest of the file isn't redefining $_FILES.
  23. Are you doing print_r($_POST) or print_r($_FILES)? It looks like from what's being printed you're using $_POST, change it to $_FILES
  24. The name of your file is "myfile" not "Filedata" - change $uploadFile = $uploadDir . basename($_FILES['Filedata']['name']); to $uploadFile = $uploadDir . basename($_FILES['myfile']['name']); as well as any other instances of "$_FILES['Filedata']" to "$_FILES['myfile']"
  25. Ah, you're on a Windows server. I'm sorry for your pain. I'm going to guess that there is an issue with your $img_dir variable - remember unlink is using the system path, not the html path. So you probably have it set to "/AdministrationAreaSublime/uploaded_images/" which is what you need for using it to populate an <img> tag, but you're going to have to have a different value that you use for the unlink command that is something like "C:\xampp\htdocs\AdministrationAreaSublime\uploaded_images\"
×
×
  • 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.