Jump to content

ginerjm

Members
  • Content Count

    5,172
  • Joined

  • Last visited

  • Days Won

    68

Everything posted by ginerjm

  1. I mis-read your newest code sample. Why do you not do a check of lockedcard item with the isset function before seeing if it has a value? That is the problem. You can't check the value of something that doesn't exist.
  2. YOu are inserting a row into a table that has a single column that contains a 1. That's it? A completely unrecognizable piece of data? As for remaining on the page. Well - an ajax call would do this for you but are you ready for that? The alternative would be to submit the form to your same script that produced the page, do the logic to update the db and then send back the same page that you had with all the data items in their approriate fields again. Do you know how to re-display a form with the input data that use put into it before submitting it?
  3. Very nice looking!! Now you have to research why you haven't set up the variable $_SESSION['lockedcard']. All the others have been declared/set but that one hasn't. Is it perhaps mis-spelled?
  4. You posted this: if (isset($_SESSION['cartid']) && !isset($_SESSION['lockedcard'] || ($_SESSION['lockedpaypal']) && isset($_POST['cartitem']) && isset($_POST['quantity']) && is_numeric($_POST['quantity']))) { & get this PHP error :-Cannot use isset() on the result of an expression (you can use "null !== expression" instead) If you look at the manual it might make more sense. The isset function can work only on variables. It cannot work on the result of a calculation. Think about it - the function tells you if a variable has been declared. If it exists. If it is set. Simple huh? So you have this in your statement: !isset($_SESSION['lockedcard'] || ($_SESSION['lockedpaypal']) which is calling the function with an argument that evaluates to a boolean value. That is NOT a variable.
  5. You have been given an error message. Stop doing what it says you are doing. You can't use isset the way you are trying to use it. BTW - try and write statements that don't run on so long. There's nothing wrong with making your lines shorted so that they are more readable instead of running off the page/screen. Use the enter key to keep them in view.
  6. What is a "second page"? Is it another web page being sent to the client? I don't know how you define "page" since there are no real "pages" on web displays.
  7. I re-arranged your long if to make it easier to interpret: if (isset($_SESSION['cartid']) && ( $_SESSION['lockedpaypal'] != '1' || ['lockedcard'] != '1' ) && isset($_POST['cartitem']) && isset($_POST['quantity']) && is_numeric($_POST['quantity']) ) { if ($_POST['quantity'] > 0) { You have what looks like an index being used without a containing element. The use of 'lockedcard' is invalid. Do you have php error checking enabled? That would help. error_reporting(E_ALL); ini_set('display_errors', '1'); Place at the top.
  8. Proves nothing. My original post is still the problem you need to research.
  9. I don't see what that "con.php" code you just posted has to do with this particular constant.....
  10. But where does that constant (ABSPATH) actually get setup? Apparently the set of modules in use during this process is missing something that sets the constant up. Your other uses must be setting it. For some reason this use is not doing that. Something's missing.
  11. What do you mean by 'ghosted out'?
  12. On second thought I think I will just un-follow this topic. I can see there's a failure to communicate here.
  13. This code of yours is totally unreadable. Don't you get it???
  14. Hmmm.... For a 'newbie' this is an awfully complex design you are working on. May I ask how you got yourself into this pickle?
  15. As was pointed out in your previous post. Take a look at other posts on this forum (and others) to see how most people write their code.
  16. And turn on php error checking - it will probably point out the error GW has diagnosed with a line number
  17. The answer is to use a recursive function. Run this: $array1 = array( 'key'=>'value', 'key2'=>'value2', 'key3'=>'value3', 'arr2'=>array( 'subkey'=>'subvalue', 'subkey2'=>'subvalue2' ), 'key4'=>'value4', 'arr3'=>array( 'subkey3'=>'subvalue3', 'subkey4'=>'subvalue4' ), 'lastkey'=>'lastvalue' ); DumpArray($array1); //*************************** function DumpArray($ar) { foreach($ar as $k=>$v) { if (is_array($v)) { echo "Array $k - "; DumpArray($v); } else echo "$k - $v<br>"; } echo "End array<br>"; return; } exit(); You can add code to make the presentation neater if you want but at least this shows you how to process the nested arrays.
  18. Do you have error checking turned on? You have a hanging ) on one of your query statements. If you checked the query results you would have picked it up I think
  19. OR you don't have any query results to loop thru. Here's a cleaned up version of your current code. <?php if(isset($_GET['update'])) { $the_mentor_id = $_GET['update']; $query = "SELECT mentor_id, field2, field3, field4,..... FROM mentor WHERE mentor_id = '$the_mentor_id' "; $qresults = mysqli_query($db, $query); while ($row = mysqli_fetch_assoc($qresults)) { $mentor_id = $row['mentor_id']; echo "<h1>i am h1</h1>"; } } include 'includes/footer.php'; Question - Does the "footer.php" actually contain php code or is it the footer of your html page? Don't name it .php if it is just html code You need to start using prepared queries. Check out the manual. And if you are really new, read the PDO stuff instead of the MySQLI stuff. It's easier and better for you.
  20. For future note - please don't post your code in such an unreadable format. Do you work on it in that format??
  21. YOu have to make your functions flexible enough so that you don't have to tinker with them - just alter the arguments coming in.
  22. One last thing. Your topic heading say "inside a while loop". I do hope you know enough to not place the actual function inside the while loop. You will be "calling" it From the while loop, but you don't want it written there. IMHO functions are to be placed outside of the main line of your php code. Burying them inside the logic just interrupts one's view of the code when trying to read thru it. Your's is a one line function but when you actually have need to write a real one with many lines you'll see that you don't want to place it in the way of your thought process. Using a function is one of the best reasons to clean up your main logic and get some lines of code out of sight.
  23. You don't code much, do you? The function is as I wrote it. When you want to use it you do: player_name($curr_fname, $curr_lname); The values in these 2 vars will be passed into the function and be referenced as $fn and $ln
×
×
  • 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.