Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. Did you buy your first car before you learned how to drive?
  2. When the users upload their files, you should control the filename it is stored under. Assign the uid as a prefix to every file stored and then when you are looking for docs you just go a glob() with the id as the start of the filename mask. Of course another solution would be to have a db that stores the user's files and identifies the document by date, user id, saved doc name, description... etc. A query for docs by uid would give you the list of filenames. Again you would want them to all be unique filenames so you should be assigning them
  3. Is this some kind of school project that you come here with no code to show at all and only want someone to write you a solution?
  4. What the h... is this video supposed to do with your problem????! OK - just tell us. What is the name of this script file?
  5. "The only example you could find on the internet"? Example of what?
  6. Uhhh - you write some code???
  7. You're trying to write a script (using out dated code1) that will ban users based on their IP?
  8. What's a 'kicking' or 'kick'?
  9. Focusing on your last point - Can't you look for the occurrence of a new company which indicates that you need to close out the last one before continuing with the just fetched row?
  10. Error reporting: error_reporting(E_ALL | E_NOTICE); ini_set('display_errors', '1'); Place at top of your php
  11. Reading the manual like all good php programmers should do I see that there is an install option that must be enabled. Read up on it and see if that is your problem PS - your code worked just fine for me.
  12. How do you create entries in this table? How do you get rid of entries when user is not logged in? How do you know they didn't just close their browser and appear to be still online? This was a topic a couple of weeks ago on some forum and there are a lot of issues with trying to keep track of who is online and who is not. Did you figure out a way to do just that? Love to see your code!
  13. I"ll throw my $.02 in and say perhaps the url you specified is not being opened since it is not technically a 'file'. You could check your get results and see?
  14. HTH!! Although - I'm not sure it's working correctly since I see a single tr / td start tag inside the loop and then a tr / tr end tag after the loop. Where are the other row and element tags created? Makes for some hard reading - especially when you come back next month and want to remember how it works. Does the listBranch function called from the loop finish the started td element and row element? Does the listbranchcontact function create its own row element completely? Might be better to include that in each of the functions so the reader can make better sense.
  15. fetch_assoc returns an array of ONE row. This is how you process query results - grab a row and process it, then loop thru and thru until all rows are handled. Other things - you don't want to start a table inside the while loop, do you? An html table for each row of the results? Also - you don't want to set lastbranch to 'xxx' inside the loop either.
  16. You had the right idea to start with -just bad coding. When you get your query results simply use them to process your data instead of moving them to a local array as you did and then loop thru that. while ($row = $qrslts->fetch()) { (process each row) } No need for the branch_array at all - you already have an array of sorts from the query (actually it's called a 'resource') that you can loop thru with the fetch call. Now - if you are not already doing a fetch before all of your loops then my initial guess was incorrect. At this point Mac_gyver may have given you your answer in that your own code is not processing that first row. Change your code to do just ONE loop using fetch() and let's see the new code.
  17. You s/b using the JOIN operator in your sql to gather ALL the needed data in just one query. Also - as mentioned - never run queries inside loops. Change your thought process to tackle the queries in one pass and not in a loop.
  18. When I see a post mentioning "losing the first row" I immediately see someone with a fetch followed by a loop doing more fetches. That first fetch is killing you! So - check how you process all your query results until you find that early-bird fetch.
  19. Might be time to invest in a modern PHP programming book that covers the whole range of php programming. Perhaps one that includes sql too so that you may see how to safely build query statements. Check out the bookstores near you for some titles and then post them here for some reaction, if you can. Or maybe this post will trigger some recommendations immediately. The reason we are all suggesting that you do things differently is to enforce some good practices upon you - which you yourself state that you wish to do too. So Do It! IMHO - I think that PDO is the way to go. #1 - it is not that hard to pick up - there are some very good examples in the php manual. #2 - once I did it I started to read posts that informed me that it is a more generalized db interface that can work with non-MySQL systems. Big plus! Make sure that you write you db connection code in its own little script and then simply include that with a dbname as a parameter to be able to use it in all your future scripts. (The include will connect using your universal uid/pswd as well as do a select of your db.) You may not have the credentials of a 'school/university' diploma but you are making inroads on a technology all by yourself. Keep going as you are ( or faster) and who knows what you can do?
  20. Forgiving you all the laziness in your coding practices to date, I ask "What happens when password <> savedpassword"? You don't go that far but that seems to be the problem. 1 - don't use MySQL. Stop trying to learn it. 2 - Always sanitize user input and don't use them directly in queries 3 - Don't save a password value in a db without encrypting it. And a personal tip: Since php is a case sensitive language try not to use both upper and lower case letters in your var names. It will only cause you trouble as you go on when you accidentally mis-type a name and then have to figure out why your code isn't working. Stick to all lowercase.
  21. Besides learning php you could really use some help with writing English. Phpadmin has nothing at all to do with json or php. Why do you mention it here?
  22. First - you REALLY should listen to what others have said. The extension you are using for db access is soon going to disappear - then where will you feeble knowledge of MySQL_* be? Second - you turn on error reporting in the middle of the code. Turn it on at the beginning and turn it on correctly. error_reporting(E_ALL | E_NOTICE); ini_set('display_errors', '1'); so that you can SEE the errors. Third - is the db name you are using a defined Constant? If not your error is right there in your select. Hopefully turning on error checking will pick that up as well as any other errors you have. Fourth - Please don't use subjects for your posts such as the one you just used. Think about ir - Everybody here needs help. How does your un-impressive subject get the attention your problem requires?
  23. PHP tip: There is no need to repeat the php tags for multiple lines of code. Wax on (code)(code) Wax off.
  24. to enable error reporting place this at the top of your php: error_reporting(E_ALL | E_NOTICE); ini_set('display_errors','1'); AND - if trq (note his experience level!) says your code is out-dated, you are definitely driving down a dead-end road here. Get a newer tutorial.
×
×
  • 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.