Advertisement
crayawn

PHP Woes

Aug 11th, 2013
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.72 KB | None | 0 0
  1. (2:49:58 PM) Dennis Kupec: its been a week and i still havent got this php script to work
  2. (2:50:08 PM) Neil Vallon: jesus
  3. (2:50:17 PM) Dennis Kupec: i have no idea what im doing wrong
  4. (2:50:24 PM) Neil Vallon: everything
  5. (2:50:33 PM) Dennis Kupec: probably. u should look at it
  6. (2:51:02 PM) Neil Vallon: probably should... hold on let me take some antidepresents first
  7. (2:51:40 PM) Neil Vallon: maybe some lithium
  8. (2:51:52 PM) Dennis Kupec: tylenol
  9. (2:51:53 PM) Dennis Kupec: http://pastebin.com/1SW1hwvN
  10. (2:54:14 PM) Neil Vallon: annnnd im back.. swallowed a battery
  11. (2:54:48 PM) Dennis Kupec: electrolytes help too
  12. (2:54:49 PM) Neil Vallon: oh dear god sockets
  13. (2:55:40 PM) Neil Vallon: allright... you explain what thats suposed to do.. im actualy going to go need tylenol for this
  14. (2:56:12 PM) Dennis Kupec: ping server, if online update data in database, else place 0's and set status to 1 more than what it was
  15. (2:56:15 PM) Dennis Kupec: and do that to all rows
  16. (2:57:14 PM) Dennis Kupec: also at he end check for rows with statuses that are equal to or greater than 2880 and delete those rows
  17. (2:58:04 PM) Neil Vallon: does the ping work
  18. (2:58:08 PM) Dennis Kupec: ya
  19. (2:58:21 PM) Dennis Kupec: <link protected>
  20. (2:58:27 PM) Neil Vallon: what isnt
  21. (2:58:30 PM) Dennis Kupec: 25565
  22. (2:58:34 PM) Dennis Kupec: the sql updating
  23. (3:00:22 PM) Neil Vallon: so you loop the whole DB and update whether online or not
  24. (3:00:29 PM) Dennis Kupec: ya
  25. (3:02:00 PM) Neil Vallon: status=status+1 is that valid sql?
  26. (3:02:05 PM) Dennis Kupec: ya
  27. (3:02:31 PM) Dennis Kupec: <link protected>
  28. (3:02:37 PM) Dennis Kupec: the script works and dosent spit out errors
  29. (3:04:48 PM) Neil Vallon: Ive never seen AND used in an UPDATE
  30. (3:05:08 PM) Dennis Kupec: should be a comma but dosent spit an error
  31. (3:05:20 PM) Neil Vallon: but does it work
  32. (3:05:37 PM) Dennis Kupec: no?
  33. (3:06:16 PM) Neil Vallon: then for christ sake try commas
  34. (3:06:24 PM) Dennis Kupec: k
  35. (3:06:47 PM) Dennis Kupec: and the integers doine neeed the quotes
  36. (3:07:09 PM) Neil Vallon: no
  37. (3:07:52 PM) Dennis Kupec: didnt help the issue
  38. (3:09:06 PM) Neil Vallon: it is looping rite
  39. (3:09:11 PM) Dennis Kupec: ya
  40. (3:09:17 PM) Dennis Kupec: it works for looping rows
  41. (3:11:36 PM) Neil Vallon: could it be something with your guid's
  42. (3:12:48 PM) Dennis Kupec: no because it exists
  43. (3:13:12 PM) Neil Vallon: whats an example of a guid
  44. (3:13:48 PM) Dennis Kupec: cy4xMzc1NzIxOTcwLkJRQndnUFlGb0M3WnhDN1dEZlRZTzZHMlRzY05MWTluT0xVNUFTTFk=
  45. (3:14:21 PM) Neil Vallon: so not an issue of something being escaped... whats the datatype on that
  46. (3:14:41 PM) Dennis Kupec: varchar
  47. (3:15:47 PM) Neil Vallon: uhhhhhhhhhhh....
  48. (3:16:18 PM) Neil Vallon: try doing that part by id
  49. (3:16:29 PM) Neil Vallon: $guid = $row['id'];
  50. (3:16:35 PM) Dennis Kupec: ya
  51. (3:16:38 PM) Neil Vallon: WHERE id='$guid'"
  52. (3:17:48 PM) Dennis Kupec: nope
  53. (3:19:21 PM) Neil Vallon: and the 'lastrefresh' update does work?
  54. (3:19:28 PM) Dennis Kupec: yup
  55. (3:19:58 PM) Neil Vallon: get rid of the $con2 and just use $con for everything
  56. (3:20:15 PM) Dennis Kupec: but then itl keep a shit ton of connections open
  57. (3:20:49 PM) Neil Vallon: no it wont.. right now your opening a shit ton... that will just open one and keep it open
  58. (3:21:04 PM) Dennis Kupec: k. well it didnt change anything
  59. (3:21:14 PM) Neil Vallon: son of a bitch
  60. (3:21:55 PM) Dennis Kupec: now captchas arent working. kill me.
  61. (3:22:15 PM) Neil Vallon: oh thats been broken for a while
  62. (3:22:24 PM) Neil Vallon: meanin to tell ya
  63. (3:23:48 PM) Neil Vallon: get rid of "WHERE guid='$guid'" entirely and make sure its atleast touching the DB
  64. (3:23:55 PM) Dennis Kupec: k.
  65. (3:25:28 PM) Dennis Kupec: didnt do anything
  66. (3:25:43 PM) Neil Vallon: var_dump($row)
  67. (3:26:15 PM) Dennis Kupec: it dumps
  68. (3:26:26 PM) Neil Vallon: lol
  69. (3:27:04 PM) Dennis Kupec: result dumps too
  70. (3:27:12 PM) Neil Vallon: var_du... damn
  71. (3:27:36 PM) Dennis Kupec: the numbers dump as strings but thats not a problem i dont think
  72. (3:28:05 PM) Neil Vallon: echo something on both sides of the if and see which path its taking so i can focus on one
  73. (3:28:34 PM) Neil Vallon: whats the datatype of status in the DB?
  74. (3:28:51 PM) Dennis Kupec: integer and its going else
  75. (3:30:09 PM) Neil Vallon: mysqli_query($con, "UPDATE `serverlist` SET players=1337");
  76. (3:30:26 PM) Neil Vallon: sanity check to see if its posible to get something to work
  77. (3:30:50 PM) Dennis Kupec: worked
  78. (3:31:07 PM) Dennis Kupec: im gonna try pdo real quick
  79. (3:31:27 PM) Neil Vallon: mysqli_query($con, "UPDATE `serverlist` SET players='$cp'");
  80. (3:32:13 PM) Dennis Kupec: that dosent work
  81. (3:32:27 PM) Neil Vallon: mysqli_query($con, "UPDATE `serverlist` SET players=$cp");
  82. (3:32:51 PM) Dennis Kupec: nope
  83. (3:33:10 PM) Neil Vallon: $cp = (int) $result[3];
  84. (3:33:34 PM) Dennis Kupec: wait wait wait 1 sec
  85. (3:33:57 PM) Dennis Kupec: $cp will be 0, gonna use mxp instead
  86. (3:34:11 PM) Neil Vallon: yaaaa...
  87. (3:34:40 PM) Dennis Kupec: yaaa that did nothing
  88. (3:34:46 PM) Dennis Kupec: i echoed the value and its there
  89. (3:34:58 PM) Neil Vallon: neither of them?
  90. (3:35:16 PM) Dennis Kupec: 1 sec let me try casting them as integers
  91. (3:35:32 PM) Dennis Kupec: that didnt work either
  92. (3:35:41 PM) Neil Vallon: ffs
  93. (3:36:04 PM) Neil Vallon: mysqli_query($con, "UPDATE `serverlist` SET players=".$cp);
  94. (3:36:38 PM) Dennis Kupec: nope
  95. (3:37:09 PM) Neil Vallon: ok... revert back to what you sent on pastebin
  96. (3:37:26 PM) Neil Vallon: $cp = "5";
  97. (3:38:12 PM) Dennis Kupec: i changed both values, didnt work
  98. (3:38:31 PM) Neil Vallon: da actual fuck
  99. (3:38:49 PM) Dennis Kupec: this has no reason why it shouldnt work
  100. (3:39:15 PM) Dennis Kupec: WAIT
  101. (3:39:18 PM) Dennis Kupec: i remeoved the ANDs
  102. (3:39:19 PM) Dennis Kupec: and it worked
  103. (3:39:41 PM) Neil Vallon: put the query string into a separate variable and echo that out
  104. (3:41:04 PM) Dennis Kupec: <link protected>
  105. (3:42:38 PM) Neil Vallon: for the fuck of it... `backtick` the column names and unquote the values
  106. (3:43:42 PM) Dennis Kupec: k
  107. (3:44:33 PM) Dennis Kupec: nope
  108. (3:45:03 PM) Dennis Kupec: maybe its php?
  109. (3:45:06 PM) Neil Vallon: remove the where part again
  110. (3:45:29 PM) Dennis Kupec: did nothing
  111. (3:46:48 PM) Neil Vallon: semicolon at the end? im running out of ideas
  112. (3:47:15 PM) Dennis Kupec: lol no
  113. (3:47:22 PM) Dennis Kupec: im thinking its php
  114. (3:47:44 PM) Neil Vallon: try pasting it in phpmyadmin
  115. (3:48:19 PM) Dennis Kupec: UPDATE `serverlist` SET `players`=4, `maxplayers`=100, `status`=0;
  116. (3:48:21 PM) Dennis Kupec: that worked
  117. (3:48:43 PM) Neil Vallon: ...
  118. (3:49:17 PM) Neil Vallon: now paste that into the php as a string
  119. (3:50:08 PM) Dennis Kupec: worked
  120. (3:51:33 PM) Neil Vallon: now instead of using a plain string like "`players`=4," do "`players`=".4.","
  121. (3:51:42 PM) Neil Vallon: so it has to cast the int
  122. (3:51:53 PM) Dennis Kupec: k
  123. (3:52:58 PM) Neil Vallon: forget a dot?
  124. (3:53:05 PM) Dennis Kupec: no
  125. (3:53:29 PM) Dennis Kupec: idont see what i did wrong
  126. (3:53:36 PM) Neil Vallon: paste
  127. (3:53:49 PM) Dennis Kupec: "UPDATE `serverlist` SET `players`=".0.", `maxplayers`=".100.", `status`=0;";
  128. (3:54:48 PM) Neil Vallon: fuck php... "UPDATE `serverlist` SET `players`=".(0).", `maxplayers`=".(100).", `status`=0;"
  129. (3:54:57 PM) Dennis Kupec: ...
  130. (3:55:03 PM) Neil Vallon: yeah
  131. (3:55:32 PM) Dennis Kupec: worked
  132. (3:56:11 PM) Neil Vallon: and you are dead ceritan that $result[3] and $result[4] are what you want them to be
  133. (3:56:48 PM) Dennis Kupec: ya
  134. (3:56:55 PM) Dennis Kupec: var dump shows that, so does an echo
  135. (3:57:12 PM) Neil Vallon: keep the parens and throw the $cp and $mxp back in i guess
  136. (3:58:26 PM) Dennis Kupec: guess what
  137. (3:58:42 PM) Neil Vallon: you've decided to learn bottle?
  138. (3:58:50 PM) Dennis Kupec: tempted but it didnt work
  139. (3:59:07 PM) Neil Vallon: https://gs1.wac.edgecastcdn.net/8019B6/data.tumblr.com/tumblr_m26nvnNG5o1qkk10ro1_500.jpg
  140. (3:59:29 PM) Dennis Kupec: god yes. ive never had a situation where that image fit it so well
  141. (4:00:39 PM) Neil Vallon: jesus fucking christ.. could i break up this problem any further?
  142. (4:00:50 PM) Dennis Kupec: i have no idea
  143. (4:00:55 PM) Neil Vallon: anything i have not covered
  144. (4:01:09 PM) Dennis Kupec: nope i dont think so.
  145. (4:01:28 PM) Neil Vallon: leave the var_dump($result) in there
  146. (4:03:00 PM) Dennis Kupec: done
  147. (4:05:19 PM) Neil Vallon: echo mysqli_error($con);
  148. (4:05:51 PM) Dennis Kupec: nothin
  149. (4:05:59 PM) Neil Vallon: I'm done
  150. (4:06:15 PM) Neil Vallon: http://bottlepy.org
  151. (4:06:39 PM) Dennis Kupec: ROFL
  152. (4:06:57 PM) Dennis Kupec: this conversation needs to be put on reddit
  153. (4:07:22 PM) Neil Vallon: thats fucking ridiculous
  154. (4:07:58 PM) Dennis Kupec: its php's fault
  155. (4:08:29 PM) Neil Vallon: Scientifically proven
  156. (4:10:10 PM) Dennis Kupec: http://pastebin.com/LVpuyQ6s
  157. (4:10:11 PM) Dennis Kupec: archived
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement