Jump to content

ginerjm

Members
  • Content Count

    4,898
  • Joined

  • Last visited

  • Days Won

    63

ginerjm last won the day on July 27 2019

ginerjm had the most liked content!

Community Reputation

235 Excellent

2 Followers

About ginerjm

  • Rank
    Handball player
  • Birthday 03/23/1952

Profile Information

  • Gender
    Male
  • Location
    Voorheesville NY

Recent Profile Visitors

58,117 profile views
  1. If your numbers are going to be 1-5 then you might try this: // assume that $i is the number 3 $idx = $i-1 echo "Name is: ".$name[$idx];
  2. If they are still looking for a solution.... It is 3 months old afterall.
  3. The braces are required when embedding complex variable names (an array element) inside other things. Without them you would get a syntax error. You could use concatenation (dots) to avoid this but with the braces you can skip the concatenating and just compose one contiguous string here. The thing I wanted you to note was the quotes on the array indices. A Key thing!
  4. So - by now you should have managed to make these 2 changes manually. So - what's the problem?
  5. You should study Barand's code carefully since it corrects some syntax errors that you were making as well as solving your problem. Array indices need to be in quotes unless they are php vars themselves.
  6. I think I know what you are trying to do and that is to modify a block of code that exists in several files. So - my suggestion is to stop and re-think your actions here. Why not alter all those lines to one call to a function passing in a variable? Then write a stand-alone module that contains this function and have it do the work. This way if you need to change this once again, you would only have to worry about one existence of this code.
  7. NO I didn't look at the code. People who post reams of code without thought for the people unfamiliar with the thoughts, ideas and processes being used and expect it to be resolved for them just aren't thinking. If you want help try and make it possible for others to help you - that is my point. Do some debugging; isolate the location of the problem and dig into it and only then post it and ask for help. PS - judging from the timbre of your own post I have to wonder how miserable you must be to write that. Tsk, tsk....
  8. Needing 2 parms means that your connect didn't provide the proper result for the select_db call. Figure out first why your connection fails. Usually a good thing to check whenever you open a db connection. if ($mysqli->connect_errno) { echo "Connect failed, error is: " . $mysqli->connect_error); exit(); }
  9. And you want US to write your php script from this stuff? I Don't Think So.
  10. You are making a tutorial? Really? And you don't understand what is wrong with the quote of yours above? The Globals array contains all defined variables of your current session. Even your current running process. So - if you have defined something such as $name that is defined in the Globals array. Thus if you reference $name it already IS known as $GLOBALS['name']. Of course I don't understand your syntax when you mentioned "value(name)" so my assumption of defining a var called $name may be totally wrong. Perhaps you could clarify what you meant by the use of "value(name)"? And as others have said. $GLOBALS is not something that anyone uses. It's just not. That and the $_REQUEST array are not preferred even tho they still exist. If you want to reference something, do it properly, i.e., look for php vars such as $name or $x or $arr, blah,blah,blah or $_POST or $_GET instead of $_REQUEST. And if you want to make a local script var known inside one of your functions, either pass it in as an argument or declare it as global using the global construct inside each function that you want it known in.
  11. I know it sounds like a fun project to emulate something that already exists. But - just exactly why do you think it necessary? There is already a $_SESSION array (RTFM) and the ability to make specific local vars global for your entire script (see 'global') . So what design of yours is going to need your own new version of this? Besides - good programming practice does not include making everything globally available.
  12. Specifying an index without quotes makes php do a tedious evaluation of that unknown value and assuming that it is a constant of some kind. Definitely not the already-defined var name that you have in mind. Indices need to be quoted string values or defined php vars (which don't need quotes).
  13. Well, GW gave you an answer that had 2 options. Obviously the second one is the one you need to pursue.
×
×
  • 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.