Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. 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.
  2. 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.
  3. 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?
  4. 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.
  5. 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?
  6. 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?
  7. PHP tip: There is no need to repeat the php tags for multiple lines of code. Wax on (code)(code) Wax off.
  8. 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.
  9. 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.
  10. 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.
  11. What errors are you getting on that line? BTW - there is a semi at the end of the line - doesn't belong there.
  12. 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.
  13. As I already told you. Actually it is a permission issue. Do you have permitted access to that folder and/or file?
  14. 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');
  15. 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.
  16. As Mogosselin says - you can use the $_SESSION array. Which you are already using as I see "$_SESSION['applicant'] already in use in your code!!!
  17. Unless your script intentionally 'completes in seconds" you should not have a problem except in very extreme circumstances. Scripts that do not involve tedious processes involving lots of data accesses or queries (not wrapped around a 'flock') will usually complete in much less than a second. That means you would have to have many users hitting your app regularly to reach a true impass. As long as your script is well writeen and doesn't put an unduly long lock on a resource, I would not expect any collisions. The lock is merely a tool to ensure that your script succeeds in posting its results.
  18. To elaborate on digitzer's post - if you find the <input> tag that has a name attribute that suggests it is for the phone number entry, remove any associated picture attribute that is part of that tag. That would be one way it is being forced to a certain format. In fact html 5 puts out a message on screen when the user tries to enter something that doesn't fit the picture. If otoh there is no picture clause, you'll need to look thru php code for that input tag's 'name=' value and see what php is doing with the input value to enforce formatting.
  19. Since this is a multi-post I'll let you get my answer from your other site posting. Same problem - same answer.
  20. Maybe you should show the code so that we can help you identify how the formatting is occurring now and then we can help you remove it. That's pretty constructive.
  21. Took a quick look (something I don't usually do - look at att. files) and see some pretty lengthy code with queries inside your loops. Not good. Work on joining you queries up into one. Also - do you not know what the ! operator is? You constantly write if conditions that only have an else to them and no code for the 'true' condition. Try doing the reverse, as in if (!empty(xxx)) and drop the do nothing part and the else clause Your question refers to your insistence on fetching the first row before you begin your loop. That's where you are losing the first entry. Set your test variable to 'xxx' and then begin your loop without retrieving a row. The way you do it now you have already set your test var when the second row is retrieved so therefor if the county matches you won't have that first heading.
  22. Just the opposite. He sets that to false so that PDO doesn't emulate, ie, use un-prepared queries, and in fact DOES use prepare queries.
  23. We work with code on this forum. We are not seers so don't expect us to hypothesize and answer for you.
×
×
  • 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.