Jump to content

PNewCode

Members
  • Posts

    331
  • Joined

  • Last visited

Everything posted by PNewCode

  1. @phppupexactly. Thats where I get stuck. So everything else is working except for the adding one to the other users tokens. Thats what lead me here. "gname" is the name of the selection that is being sent from the first page. So I would assume that would act as the name of the person that is getting the tokens. It's a drop down list that has all the current users. One gets selected, then click the button, and then it sends to the page with the script I posted. So while the rest is working to subtract one from the user logged in, perhaps having one added to someone else isn't possible?
  2. Also, I'm using a test user account to try to transfer to, which has a balance of 0 tokens starting out. And I'm sending from my own account, that has 141 tokens
  3. @phppup that got rid of the errors. But there was no function done for the tokens. None subtracted or added anywhere. If I remove that update completely then it will subtract one still though. So the issue is still how to make that happen and also add one to the other one. Head scratcher for certain. I'm not sure what PDO is to be honest. I just grabbed that bit of code from another page that was working and stuck it in there. Seemed to do the trick for making the rest work so far.
  4. I should add, that those other 2 databases that the info is sending to, is also a record of these transactions too
  5. Right. Before adding this, there were no errors. Here is the exact code I just added $gname = $row["fname"]; $user_updated_token = ($user_token) + 1; $sql_l = "UPDATE users SET token='$user_updated_token' WHERE id=$gname"; And line 119 is if ($conn_l->query($sql_l) === TRUE) { And the cluster around that with what I added is $user_updated_token = ($user_token) - 1; $sql_l = "UPDATE users SET token='$user_updated_token' WHERE id=$user_id"; $gname = $row["fname"]; $user_updated_token = ($user_token) + 1; $sql_l = "UPDATE users SET token='$user_updated_token' WHERE id=$gname"; if ($conn_l->query($sql_l) === TRUE) { echo ""; } else { echo "Error updating record: " . $conn_l->error; }
  6. @phppup Nope it didn't work. I got this Warning: Trying to access array offset on value of type null in insert.php on line 113 Fatal error: Uncaught mysqli_sql_exception: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 in insert.php:119 Stack trace: #0 insert.php(119): mysqli->query('UPDATE users SE...') #1 {main} thrown in transfer/insert.php on line 119 Which tells me that... purple? haha
  7. @phppup you're correct, though I have that in place already. When they use a token right now (to play a game) then that transaction with a balance is already in the database under a different table. It also shows what the balance was before and after each transaction. I also have it set up already where I can email them that information
  8. @phppup okay I think I"m following you. So right now, it doesn't know where to put it because there's no column for it. So... would this work? Or am I at least close? $user_updated_token = ($user_token) - 1; $sql_l = "UPDATE users SET token='$user_updated_token' WHERE id=$user_id"; $gname = $row["fname"]; $user_updated_token = ($user_token) + 1; $sql_l = "UPDATE users SET token='$user_updated_token' WHERE id=$gname";
  9. Just something to add... this is only for use with a small group of 25-30 members. It's not for a public thing where I have to worry about too much mischief and stuff. It's just a small group of people that have some fun with some goofy games we play with each other (not even as good as games you buy or download lol)
  10. @phppup no there isn't a column name for gname gname is the name of the form field that is being sent to this page that I posted. So on the page that has the form, they select from a drop down list of current users. I named that drop down list "gname" In the database, there is just fname (for the name) and tokens (for the amount of tokens they use) of course there are other columns too but they don't matter for this project
  11. @mac_gyver hey there. I put in the original post the reason for the different databases. I don't want access given to the one that holds the information over long periods of time, given to anyone but me. So the other one serves as a daily use by me and others. And like I said, I know it's the long way around but it's all I know how to do right now. I'm not as experienced as you. All that other stuff you posted, which I'm sure is logical and well said, is greek to me as I am only a few months into learning this. So the "why do you want to do this"... stuff doesn't help. I can't learn from that. But thank you very much I do appreciate the time you took to type that out for knowledge
  12. @phppupcorrect. The one for subtract is working (which is what I have now) I'm just missing something because when I replicate that to add one, I can't seem to get it to go to the "gname" (which isn't shown in my post because it didn't work. I wanted to only show what I have currently working)
  13. Another way to break it down is.. lets say... Bob has 15 tokens Bob uses this to give Sally 1 token When it gets to this page that I have in the post, then 1 token is taken away from bob (fname) and one token is given to Sally (gname) Now Bob (fname) has 14 token And now Sally (gname) has 1 token
  14. @phppup exactly. I just can't seem to figure out how to do that. So far it successfully subtracts from the gifter. But I don't know how to get it to add to the giftee If the gifter has 0, then it tells them they don't have enough tokens to give any away. That part works too so far
  15. @benanamenthank you for that reply and for the link to look over. I don't understand how to translate that into adding what I have to make it work though.
  16. Hello. This is what I have working so far, and this works without a problem (see after for why I'm posting this) Right now, this file will add information to 2 different databases (one of them serves as a backup, the other can be edited as needed) This also removes one "token" from the user in the session. Perfect! Thats what I need it to do. HOWEVER, what I also need it to do, is add a token to the user defined by "gname" in this same transaction. In the page that is sending the info to the below scripting, the person logged in (fname) selects a user to give a token to (gname) Any thoughts from all of you amazingly smart people here, on what to add to this to make it work would be appreciated. I seem to hit a brick wall. In case anyone wants to know "why" I'm doing this... here is the break down A user is logged in. They decided they would like to give a different user one of their tokens (because they are just a nice person). So they send one to them. At the same time, this transaction is being sent to 2 more databases. One of the databases will be cleared out each day. The other one will store all the transactions as a way to look up the history of transactions. (it's the long way around, but I'm old and this is the easiest way for me to do this) What I tried: Besides the endless alterations from stuff I googled that didn't work, I also tried to duplicate the linke for -1 and change it to +1 but it didn't do anything (even when I changed it to gname) <?php error_reporting(E_ALL); ini_set('display_errors', '1'); // Start the session session_start(); $servername = "Deleted To Post This"; $database = "Deleted To Post This"; $username = "Deleted To Post This"; $password = "Deleted To Post This"; $servernameS = "Deleted To Post This"; $databaseS = "Deleted To Post This"; $usernameS = "Deleted To Post This"; $passwordS = "Deleted To Post This"; // Create connection $conn = mysqli_connect($servername, $username, $password, $database); $connS = mysqli_connect($servernameS, $usernameS, $passwordS, $databaseS); // Check connection if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } if (!$connS) { die("Connection failed: " . mysqli_connect_error()); } echo " "; $fname1 = $_POST['fname']; $tokens1 = $_POST['tokens']; $gname1 = $_POST['gname']; $fname = mysqli_real_escape_string($conn , $fname1); $tokens = mysqli_real_escape_string($conn , $tokens1); $gname = mysqli_real_escape_string($conn , $gname1); $hostname_l = "Deleted To Post This"; $username_l = "Deleted To Post This"; $password_l = "Deleted To Post This"; $dbname_l = "Deleted To Post This"; $conn_l = mysqli_connect($hostname_l, $username_l, $password_l, $dbname_l); if(!$conn_l){ echo "Database connection error".mysqli_connect_error(); } $user_id = $_SESSION['id']; $sql_l = "SELECT * FROM users WHERE id = '$user_id'"; $result = $conn_l->query($sql_l); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { $user_token = $row["token"]; $fname = $row["fname"]; } } else { echo "0 results"; } if($user_token >= 1){ }else{ echo "<h2 style='text-align:center;color:white'>You don't have enough tokens </h2><br><center><a href='moretokens.php'><img src='buytokens.png' border='0'></a><center> <br><br><br><br><br><br><br><br><br><br> <center><a href='main.php'><img src='imgs/cancel.png' border='0'></a><center> "; die(); } $sql = "INSERT INTO nametable (fname, tokens, gname) VALUES ('$fname', '$tokens', '$gname')"; if (mysqli_query($conn, $sql)) { $user_updated_token = ($user_token) - 1; $sql_l = "UPDATE users SET token='$user_updated_token' WHERE id=$user_id"; if ($conn_l->query($sql_l) === TRUE) { echo ""; } else { echo "Error updating record: " . $conn_l->error; } } else { echo "Error: " . $sql . "<br>" . mysqli_error($conn); } if (mysqli_query($connS, $sql)) { echo " "; } else { echo "Error: " . $sql . "<br>" . mysqli_error($connS); } $id = mysqli_insert_id($conn); mysqli_close($conn); mysqli_close($connS); ?> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <body link="#CCCCFF" vlink="#CCCCFF" alink="#CCCCFF"> <script> document.addEventListener('contextmenu', event => event.preventDefault()); </script> <style type="text/css"> body {background:none transparent; } </style> <div align="center"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td valign="top" height="84" colspan="7"> <div align="right"> <p><br> </p> </div> <div align="center"> <p>&nbsp;</p> <p>&nbsp;</p> <p><img src="../requests/imgs/completed.png" width="500" height="300"></p> <p><font face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">Now Sending You Back To Token Gift Options<br> </font><font face="Verdana, Arial, Helvetica, sans-serif"><br> <br> </font></p> </div> </td> </tr> </table> </div>
  17. Excellent point. I will do that for now on. To be honest with this one I don't remember specifically what page I was working on at the time haha. Sorry about that. For now on I'll be certain to post the answer so others can benefit from it
  18. Admins, feel free to delete this as I found the answer on my own
  19. @requinixyes in a way. However I found a trick in the depth of the internet that makes it exactly how I want it (this might be what you were talking about I'm not sure). I added 66% { opacity:0; } Between the 0% and 100% and it allows a delay. I had to lengthen the time of total animation to make it work but it's perfect.
  20. @requinixI decided to just add a meta tag to have it redirect after 4 seconds to the next page so no click needs to be done, however I would like to have the animation delayed 2 or 3 seconds before it fades in the second picture. Do you know how I can alter what I have to do that? I tried adding some coding in it from what I have seen online in examples but none of them seem to work, but then again the examples I saw didn't have what I have set up either so I'm lost on how to do that.
  21. I have the following script below. The fade in is working beautifully. What I want to do is make it so that 2nd image doesn't fade in untill the first image is clicked on (the first image is acting as a button) And then after the 3 seconds for the fade in, it goes to a different URL. Any thoughts? <!DOCTYPE html> <html> <head> <body bgcolor="#000000" marginwidth="0" marginheight="0"> <div class="parent"> <img class="image1" src="../trial-images/unzoomdoor.jpg" width="100%" height="887" border="0" /> <img class="image2" src="../trial-images/zoomdoor.jpg" width="100%" height="887" border="0" /> </div> <style> .parent { position: relative; top: 0; left: 0; } .image1 { position: relative; top: 0; left: 0; border: 0px solid #000000; } .image2 { position: absolute; top: 0px; left: 0px; border: 1px solid #000000; animation: fadeIn 3s; -webkit-animation: fadeIn 3s; -moz-animation: fadeIn 3s; -o-animation: fadeIn 3s; -ms-animation: fadeIn 3s; } @keyframes fadeIn { 0% { opacity: 0; } 100% { opacity: 1; } } @-moz-keyframes fadeIn { 0% { opacity: 0; } 100% { opacity: 1; } } @-webkit-keyframes fadeIn { 0% { opacity: 0; } 100% { opacity: 1; } } @-o-keyframes fadeIn { 0% { opacity: 0; } 100% { opacity: 1; } } @-ms-keyframes fadeIn { 0% { opacity: 0; } 100% { opacity: 1; } } } </style> </body> </html>
  22. @gizmolaThank you very much for taking all that time to give some assistance. I really appreciate that. Looks like at this point I can either go without the page working untill I can learn enough to understand everything you just said, or dig up some pennies to hire someone to make me a new one (which will probably have to be my solution so I have something untill I learn more) I will definitely use your reply to do research and get better educated. Thank you
  23. Alert table Number table
  24. @mac_gyverthe database for the alert has 2 tables, and 1 row each. There is a different database for the alerts than the message itself. I think thats why it loops so that it just circles back to it's own update for a new entry. (I'm guessing)
  25. @BarandI just checked the log and there are no errors showing for those pages at all. There is one from a different page that's not related to this post but it's an easy fix. But for this, nothing
×
×
  • 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.