Jump to content

ginerjm

Members
  • Content Count

    4,770
  • Joined

  • Last visited

  • Days Won

    63

Everything posted by ginerjm

  1. 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?
  2. Error reporting: error_reporting(E_ALL | E_NOTICE); ini_set('display_errors', '1'); Place at top of your php
  3. 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.
  4. 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!
  5. 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?
  6. 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.
  7. 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.
  8. 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.
  9. 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.
  10. 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.
  11. 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?
  12. 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.
  13. 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?
  14. 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?
  15. PHP tip: There is no need to repeat the php tags for multiple lines of code. Wax on (code)(code) Wax off.
  16. 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.
  17. Hard to follow this bunch of code, but the error is pretty self-explanatory. You are trying to find a file that is just where you think it is. The message pinpoints the line with the problem, use the info provided to check your file system to see that the reference is accurate.
  18. line 123 - one of the vars on that line is inappropriate for whatever is going on there. Is $handle or $ver an array perhaps and you are expecting it to be a string? line 185 is bogus - somewhere else you have a usage of 'prettyPhoto' as an index into an array variable and the array doesn't have an element by that key. Simple as that. The code you showed for this problem does not appear to be the correct chunk.
  19. What errors are you getting on that line? BTW - there is a semi at the end of the line - doesn't belong there.
  20. What is 'it'? Actually when I ran your code, my error message simply said it couldn't access the file - no mention of permissions. So - PHP can see the file. You (or your php session) cannot.
  21. As I already told you. Actually it is a permission issue. Do you have permitted access to that folder and/or file?
  22. Uhhh..... I loaded this up in my ide and cleaned up the line breaks and such and the line with that message is commented out. Don't know how you could get that message with the code as it stands. So - assuming that the mangled linefeeds and carrigage returns in the cut and paste I did of your code, I removed the comments. 1 - Do Not Use the @ character to suppress an error. If there is an error You Should Fix It, not ignore it! 2 - In order to even get to that message you had to have been shown the messages (echos) prior to that. Did you in fact get them? You said all you get is that message but I don't see how you could get to the message you state without getting the others. 3 - Obviously the file open did not work. Check your path and name. AND - as mentioned in my signature - turn on error checking which will confirm the failure of the fopen. error_reporting(E_ALL | E_NOTICE); ini_set('display_errors', '1');
  23. If the var is not being used, why not use it again? Just don't get confused should be opening two files at the same time. It's no different than using $I as a counter multiple times in a script.
×
×
  • 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.