Jump to content


New Members
  • Posts

  • Joined

  • Last visited

dekip's Achievements


Newbie (1/5)



  1. Obviously not enough of data. My bad Idea is to have a device that will send some random string via GET. Say: 123gh5 On server I query DB, check last ID, increment to one more and insert that incremented ID into DB. But also put together this ID and this string and insert that, too. Let's call it newID. I hope it is not too confusing. This ID in DB is INT type, and newID is VARCHAR. But on server, it just doesn't pass $z = $x.$y;. It doesn't pass to inserting query. Say, this is GET request: somesite.com/index.php?upit=id&espID=12a456?id=12a456 And on server: if ($_SERVER["REQUEST_METHOD"] == "GET") { $action = $_GET["upit"]; if ($action == "id"){ $espID = $_GET["espID"]; $sql = mysqli_query($con,"SELECT * FROM autoSetup ORDER BY deviceID DESC LIMIT 1"); while($row = mysqli_fetch_array($sql,MYSQLI_ASSOC)){ $newID = $row["deviceID"] + 1; } echo $newID; $IDID = $newID.$espID; mysqli_query($con,"INSERT INTO autoSetup (deviceID, espID, UID, date) VALUES ('$newID', '$espID',$IDID, now())"); } } You can see here it is a part of a ESP MCU system I build. So deviceID is INT, espID and UID are VARCHAR.
  2. I have to insert $z into DB. And $z is consisted from: $x = 5; $y = "123hg5"; With $z = $x.$y; I get only 5. And I need it to be 5123hg5.
  3. Thank you! I get this and it is clear to me. However, there are some other things I would need help. As I point it above... I should check first two lines, if on both first set of bits are 0100111, than according to last 0 or 1 on the first line second set, take from second line last set of bits. Let's say, if we take 4th and 5th rows, if on those rows I2C address is the one declared somewhere above is the one I need, than take those 11101111 and put in 0 field. In 7th and 8th there is 1, so 10111100 should go into field 1. That array with 3 sets of bits has following s, and is a problem or maybe not. It might be good for a delimiter as it is after every two lines of sets. I messed up with this a week or so, and couldn't make any move, until you helped me.
  4. This one did the trick. Thank you! I really appreciate your help, but it is nothing if I don't understand what is happening here. Working solution is nice, but understanding is much better. while (($p1 = strpos($str, 'S', $p2)) !== false) { $p2 = strpos($str, 's', $p1); if ($p2===false) { // add this check $p2 = strlen($str); } echo substr($str, $p1, $p2-$p1+1) . '<br>'; } Row 1: Finding the first occurrence of an S in $str and if it is not false, than... Row 2: Get the length until an s occurs. Row 3: This I don't get quite good Row 4: Return the length of a $str Row 6: Return part of a $str from $p1 (start), to a $p2-$p1+1 (end). Please correct me where I am wrong.
  5. The main goal is to cut these numbers: And to process send them to some other tables, etc. But, these numbers are close to these: So where in these numbers last number is say 0, than I take set of numbers (byte array) just under it and do something. PS. Before everything, I have to check IF after this big S this byte array is 0100111. If not, just ignore. I hope I am a little bit clear.
  6. Let's say I have this string: I would like to make it like this: With this: I get this:
  7. This is the output from an I2C scanner. There should be bunch of 1 and 0. Not 2 or 3, though. The idea is to sort it somehow from S to s. Later to match it with some other stuff, and sort it again. For a start, I should sort, then count the length, later to match, and so on... Let's say I have a 11101011 on some place here, I should compare it with some other pattern, assign a number, and that number store in db.
  8. Hi all, I have some data in database which is stored something like this: As you may notice there is a pattern. My goal is to extract this data and print it from S to s in a loop. Can someone help me with this? It should find S and print all to the s. Not sure what function would be best to use.
  • 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.