Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. A php script is triggered by a request from a client, does it's thing, sends its output and quits. It has no life after that and the next time it is executed will be the same as the first unless there are provisions made by the designer/code to maintain some 'state' to assist in properly responding to the latest request. Does that help? If not I'm positive you could google this same question and get pages of results.
  2. The thing I have to bring up - and I'm surprised I am the first to do so - is: Do you have the right to be charging for this music? Or do you just have this fabulous collection of oldies or such that you think there may be a demand for? I, for one, would not be helpful at all to anyone stealing money from the artists' who created this treasure trove.
  3. On second thought - I take back my postulation. Show us some code that gives you this problem. Maybe 20-30 lines leading up to it and the EXACT error message and line number and (please) point out what line of code it is.
  4. Only one server? I'd guess (a big WAG) that it is the .ini file on that installation. Check the setting for short tags. I know that it can be enabled or disabled, but perhaps there is another setting to re-define what that short tag is. Perhaps someone else will weigh in on this soon. Just for grins, can you post some code that does this?
  5. Nice post Requinex! Part of the lack of understanding of posts that have worse English than their included PHP is simply that. Why, oh why, do people NOT know how to write plain old English anymore when it is obviously their native language??? Do schools only teach "computer" and not the 3 Rs (or was it 4?) anymore? All this contention about "core curriculums" in the papers and schools are forgetting the basics!
  6. Use a table of "topics" that has a topic number and a sort sequence (integer) column in it. Save your posts with that topic's number in it as well as the posting date of course. Do your query to select the contents you want to display using a join of the two tables and be sure to order the results by topic sort sequence number and posting date. No?
  7. Having found those tools that solve this ONE problem, do they also do syntax highlighting and reserved 'word' highlighting to help you produce more accurate code while you type? The product I mentioned does that with the php code to help me as I go along. Function names are highlighted when spelled/hyphenated correctly to keep me from mis-typing them. Makes a huge difference when your environment is consciously trying to help you along.
  8. What you are describing is SOMEONE else's work to produced a downloaded file. Nothing for you to do here. THEY have the php script (probably) that is sending the file to you. IF I am reading you correctly. Perhaps you are referring to something else. If so, please disregard.
  9. HTML_Kit Tools is a pretty good IDE. Highlights different types of code with diff colors; identifies matching parens, braces, brackets. Does browser previewing. Does ftp connections for each project you create in it. Free trial with no expiration but if you like it it's really not that expensive to purchase.
  10. Good developers turn on php error checking when doing their development. Try it. BTW - you actually didn't say what was NOT working. I can only assume that your email is not being sent. The headers suggestion could solve that, but if you had read the PHP manual that would have been apparent.
  11. Are you looking to create keys of some array or for table records? Or are you just looking for a single random number to use for some process? For the latter you have been provided answers. For the former, why? Just use a sequential number and then when you want to find one of them, use a random number function (limited by the max value already used) to select one of them.
  12. As expressed by others above - the habit of always ending a line with a semi is a better one that intentionally looking for the opportunity to omit a semi because of a closing PHP tag. What happens when one does maintenance to add a couple more lines and then wonders why his script is giving him errors because he forgot to edit that hanging chad? PS - I rarely ever ever use a closing php tag so I did not even know this was an issue.
  13. Please tell us that you didn't write this code. That way I feel that we could tell you to just dump it and start over and to stop copying code you find on the net. This code and the algorithm are ridiculous. 1 - you have mixed together php and html and css and made it impossible to read and follow. Learn to program by splitting these things out and doing your php at the start and your presentation at the end. 2 - stop using the DEPRECATED MySQL_* functions. That extension is done! 3 - Learn how a query process works. You begin this mess by doing an insert into tableb, then you test if it succeeded and immediately execute the same query over again. That one is sure to fail if you have any primary index. 4 - You follow #3 with another sign that this code is worthless. You do a query to select all records from tableb and then you pull ONE field from the third row and NOTHING ELSE! Why the h... did you pull all the records then? And what happens if you only have two rows at some point? PLUS - if you read the manual (where it says this is DEPRECATED) you will see a note that says not to mix MySQL_result with other result set functions, which is what you do right after this! 5 - Now you send out a mail using the less-than-perfect PHP mail() function. But you don't include any headers argument so I hope you have the php.ini file setup to handle the "from" address. To make matters worse you follow your mail call with ANOTHER MAIL CALL. Is that what you intend - to send the same message to the user twice? Forgive me for being so blunt. You are probably a newbie who has not programmed before. Let me tell you there are ways to learn and this is not the way until you have actually done some reading and learning on your own. That way you might have a chance at recognizing what the code you are copying is doing and avoid the really really bad examples such as this one. As I said - dump this code. Then layout what you are trying to accomplish in plain English and then write a script that does that. And remember to design your script so that you do the PHP code first and then execute the html/css/js code last.
  14. Why should we help you debug outdated code using MySQL? Also - that first line of the connect code - did you read it? It is specifically ignoring errors that would tell you to stop using MySQL if it even works at all. It attempts to ignore two kinds of errors, but does it ever turn ON the other types of error messages. Does it even turn on the message display so that YOU can see any errors or do you make it a habit to view the error log every time you test it? It's been so long since I used MySQL I may be missing something but you first do a connect and create a handle called $conn. Then you select a db but never reference your handle but do (attempt to) produce another handle. Does that even work? See my signature for a better way to turn on error checking. And stop using MySQL.
  15. I think a db would be perfect. A simple table could be setup with either: #1. A single record that simply states the week number. A 1-record table that just reports the week # in a field. Perhaps an additional field to record the datetime of the last change to ensure that nothing is wrong. This implies a function that does a simple query to get the week # from the single record. OR #2. A record setup for every week in the year having perhaps a start date and end date for the week with the week number assigned to each week. This eliminates any need for setting it every Sunday. You would just need a script that establishes the weeks for the coming year. This means you need a function to simply get the week for the given date in the function call. Use that date to do a select query where the arg_date >= 'start_date' and arg_date <= 'end_date' to get the current week #. Strongly suggest using a function that stands alone that you simply include in your script(s) to minimize the impact if you have to make later changes. Let the call use a date value to be used to find the week in option 2
  16. How are you keeping track of the "current week #"? In a db? Is it the same week for all users? Will you use a cron job to trigger the week change?
  17. You really need to describe this better. Is this week right now #1 or #2? And what makes it that? When did this week begin? When does it end? How does it "end"? Why does it end? Why is it even numbered?
  18. Yes - "return" is a horrible name for a table. As for your connect logic - whatever does $sRFlag have to do with it? You do a connect and check if it succeeded but using that variable makes no sense here. PS - using such complicated names for your fields and variables is going to bite you in the a.. more times than you can imagine. I strongly suggest you adopt a consistent style for naming and use it. What you are doing now is going to kill you. You do know that PHP is a case-sensitive language?
  19. I wish I knew what 'slug' was....
  20. How about: $categories = $wctTerms;
  21. The easy way would be to use common signon code that registers people to the same "system" and then modify your verification code to check that "system" instead of the one(s) they currently do. Obviously - if the two apps were well-written and used single signon and verify modules this will be an easy task. If they didn't it will be tedious and probably error-prone. That's about all we can offer since you didn't seem to post any code using the forum's usual posting procedures.
  22. The first thing that would improve it is to completely separate your processes. THINK about your html code and place that at the bottom of your script and insert php vars where you think you will have some dynamically-generated output to be displayed. THEN go back to the top of your script and start handling the task. Receive the input, validate it, use it and then execute the output of your html code. (Personally I use a function to do my entire html output that I call when I'm ready to send it.) Place your JS code either in a separate file to be included by the html portion, or place it in this separated html portion. Same for your css code. Keep the php separate! YOu may have some php/html mixed when you are building a table of output or a dropdown list but that is necessary. The idea is to keep all the static html and css and js away from the logic process.
  23. Maybe you need to do a little reading to teach yourself something before embarking on a full-fledged project?
  24. How do you know how to use them? Well - you wrote them presumably, so use them for the thing(s) that they were designed for. As for your original question. Creating a property inside a class without the declaration at the top is like creating a local variable in a normal (non-oop) function. It's local to the scope and is not known outside of that function, although your examples may lead to that being not true. When you create an object property inside a method you are going against the concept of an object. An object is a well-defined thing that has properties and methods and is meant to function as the entity that it was defined as, not with additional "things" tacked on that are not defined and not known to be part of the object. IOW - it's kinda like what M$ does with their software, and we know where that gets you.
  25. Try adding some English skills to your writing too. It will make you look smarter at least. Periods, Capitals and sentences make for better reading.
×
×
  • 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.