Jump to content

phppup

Members
  • Posts

    789
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by phppup

  1. I'd try this for starters:

    ////$gname =  $row["fname"];
    
    $gname = 20; //this will give you an easy way to spot the added value and see that it increases 
    
    $user_updated_token = ($user_token) + 1;
      $sql_l = "UPDATE users SET token='$user_updated_token' WHERE id=$gname";

    I don't use PDO, some in not sure about 

    if ($conn_l->query($sql_l) === TRUE)
    
    //would == be more accurate than ===

    And are you repeating this query? You already have it once, don't you?

  2. It seems to me that you may want to restructure your process (especially if your learning) because it's easier to learn to code correctly than to learn bad habits.

    And it's easier to find and resolve issues on smaller projects than large.

    What @mac_gyver is providing you may be advanced information, but it is accurate.

    If a user of your small group tells you that their balance is incorrect, you currently have no recourse but to shrug your shoulders and respond that your code is full-proof (not very reassuring to a disgruntled user).

    Mac's method would offer an additional table for transactions that would allow you to say, " You had this many tokens on DATE and you received X many on these dates from user 1, use 2, etc. You also gave to these people on these dates, and this is my evidence to support the inquiry."

    More advanced, but much more useful.

  3. You should not use the asterisk * to select EVERYTHING unless you NEED everything pulled from each row of the table. Only SELECT what is required for reaching your goal.

    SELECT merely pulls data.

    UPDATE will overwrite columns. WHERE will tell the table which SPECIFIC cells should be effected.

    You can search for helpful tutorials for SELECT, UPDATE and WHERE online.

  4. Legal advice is not provided here, but you can always contact an attorney or do you own research with an emphasis on your LOL locality.

    Beyond my disclaimer, I do not think that gathering the information should cause a problem.  How you use it could be a different issue.

    In other words, collecting email addresses to use to contact your customers/users would be a reasonable business activity.

    Collecting the information to coordinate malicious activity would likely be frowned upon.

    Divulging the personal data on a billboard by a highway would probably be unwise.

    But again, this would be a good reason to have some kind of notification that informs users of what you are doing and your intentions.

    If the do not agree with the terms, then they can decline.

  5. I think requinix was trying to point out, in a sarcastic tone, that any protection is better than none.

    Also, I don't see why it would be illegal to collect email addresses.

    If you are in a region that does not permit this, perhaps a notice or terms of service stating: "This website saves all applicable data during usage" will be beneficial (but I cannot provide legal advice on this).

  6. I just discovered that my domain's built-in email will no longer be included in my hosting package.

    Any recommendations for code solution or third party providers for an inbox with useful options?

  7. UPDATE:  Took a troubleshooting approach to this and managed to obtain an INSERT using a good 'ole fashioned SELECT statement WITHOUT any binding or prepared statements.

    I suppose that indicates that, as stated, all connectivity is valid.

    Now I'll move forward and count my commas, quotes, and variables to try to get to the full resolution.

    Unless there are more suggestions, I'll just say THANKS for everyone's help.

  8. @ginerjm Stalled as in the top of the page loaded perfectly, but other PHP lines that I had an echo'ed output during development (ie: print_r or echoes from a function) simply did not display beyond a certain point; as if the code simply stalled or derailed; froze or died.

    Note that while it did seem suspicious, I have reviewed my code and none of these items seems like it should interfere with an INSERT statement or the table, as they are unrelated.  I'm not entirely sure of the effects of MYSQLI_REPORT_STRICT, and really don't have the time to investigate them.

  9. I am trying to insert from a form into a table with an auto increment primary id and a default TIMESTAMP

    $sql = "INSERT INTO $table (a,b,c,TIMESTAMP) VALUES ( ?,?,?,? )";
    
    if($stmt = mysqli_prepare($conn, $sql)){
        mysqli_stmt_bind_param($stmt, 'ssss', $w,$x,$y,$z);
    
    mysqli_stmt_execute($stmt);
    
    echo "Records inserted.<br>";
    } else{
        echo "ERROR". mysqli_error($conn);;
    
    $last_id = mysqli_insert_id($conn);
        echo "Last inserted ID is: " . $last_id;

    I have eliminated all ERRORS that indicated
    Warning: mysqli_stmt::bind_param(): Number of elements in type definition string doesn't match number of bind variables

    However, I am still receiving the same code generated message

    Records inserted.
    Last inserted ID is: 0

    No data is visible when I open the actual database and view the table.

     

    @ginerjm Actually made that correction after the posting, but same issue persists. But thanks.

    PS: checked all db connectivity and everything seems to be fine from that side.

     

  10. I am trying to insert from a form into a table with an auto increment primary id and a default TIMESTAMP
     

    $sql = "INSERT INTO $table (a,b,c,TIMESTAMP) VALUES (NULL, ?,?,?,? )";
    
    if($stmt = mysqli_prepare($conn, $sql)){
        mysqli_stmt_bind_param($stmt, 'ssss', $w,$x,$y,$z);
    
    mysqli_stmt_execute($stmt);
    
    echo "Records inserted.<br>";
    } else{
        echo "ERROR". mysqli_error($conn);;
    
    $last_id = mysqli_insert_id($conn);
        echo "Last inserted ID is: " . $last_id;

    I have eliminated all ERRORS that indicated
    Warning: mysqli_stmt::bind_param(): Number of elements in type definition string doesn't match number of bind variables

    However, I am still receiving the same code generated message

    Records inserted.
    Last inserted ID is: 0

    No data is visible when I open the actual database and view the table.

×
×
  • 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.